Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

JxBrowser and Selenium WebDriver

This tutorial demonstrates how to create a simple Selenium WebDriver application that is configured to access a web page in a desktop Java application based on JxBrowser.

Creating of these example projects is described in the tutorial.

Prerequisites

The tutorial requires the jpackage tool available in PATH, so make sure that the environment variable contains the %JAVA_HOME%/bin directory.

Building and Launching

  1. In the root directory, run the downloadChromeDriver task of the launcher module to download ChromeDriver to the resources directory:

    Windows:

    gradlew launcher:downloadChromeDriver

    macOS/Linux:

    ./gradlew launcher:downloadChromeDriver

    Each version of ChromeDriver corresponds to the Chromium version used in JxBrowser. If you change the JxBrowser version in build.gradle.kts you need to update the chromiumVersion property here before running the downloadChromeDriver task. Otherwise, Selenium WebDriver will not be able to connect to Chromium. You can find which Chromium version is used in the specific JxBrowser version in the release notes.

  2. Insert your license key into the test application.

  3. In the root directory, run the buildApplication task of the target-app module to create an executable file for the current platform that later will be run by Selenium WebDriver.

    Windows:

    gradlew target-app:clean target-app:buildApplication

    macOS/Linux:

    ./gradlew target-app:clean target-app:buildApplication
  4. Run Selenium.

  5. If everything configured properly, you will see the launched test application, and the following console output:

    Current URL: about:blank
    // or
    Current URL: https://www.google.com/ 
    

    It means that Selenium WebDriver managed to successfully run the application, set up a connection with the JxBrowser's Chromium, and access the loaded web page to print its URL.