Basic usage
Extension properties
This plugin exposes the following optional properties through the extension named webdriverBinaries:
| Name | Type | Description |
|---|---|---|
|
DSL |
Configure the ChromeDriver binary to be used by the project. No ChromeDriver binary will be downloaded if the version is not set. |
|
DSL |
Configure the GeckoDriver binary to be used by the project. No GeckoDriver binary will be downloaded if the version is not set. |
|
DSL |
Configure the EdgeDriver binary to be used by the project. No EdgeDriver binary will be downloaded if the version is not set. |
|
DSL |
Configure the OperaDriver binary to be used by the project. No OperaDriver binary will be downloaded if the version is not set. |
|
|
Whether to fall back to a 32bit version of drivers if a 64bit version is not found. Defaults to |
|
|
Overrides the default architecture for all drivers. |
|
|
Override the location to obtain the metadata from. Can be anything convertible to a URI, including a file. |
As listed above, the plugin exposes DSL blocks called chromiumdriver. edgedrvier, `geckodriver, and operadriver`.
Each of these can be configured with the following properties
| Name | Type | Description |
|---|---|---|
|
String |
The exact version of binary to be used by the project. No binary will be downloaded if neither this nor |
|
String |
The regular expression for the version - the highest matching version of binary will be used by the project. No binary will be downloaded if neither this nor |
|
String |
The architecture of the binary to be used. The allowed values are |
|
|
Whether or not to fallback to a 32bit version of the driver if a 64bit version is not found. Defaults to |
|
- |
Configures the driver to use the latest version. |
Example usage:
webdriverBinaries {
chromedriver {
version = '2.32'
architecture = 'X86'
}
geckodriver {
version = '0.19.0'
architecture = 'X86'
}
edgedriver {
version = '86.0.601.0'
architecture = 'X86'
fallbackTo32Bit = true
}
operadriver {
useLatestVersion()
}
}
Example usage which shows how to configure the plugin to use the latest version of chromedriver:
webdriverBinaries {
chromedriver {
useLatestVersion()
}
}
Configuring download URLs
By default, the plugin uses information from WebDriver Extensions Maven Plugin’s package.json file to determine what URL should a given binary be downloaded from.
If a version of a binary you would like to download using the plugin is not listed in the aforementioned file you can do one of the following:
* provide a pull request to WebDriver Extensions Maven Plugin Repository 3.0 which adds the version in question to the file - the URL you add will be visible to the plugin as soon as the PR gets merged
* author an own version of the package.json file and configure the plugin to use it
If you’d like to use the latter then after authoring your own version of package.json and dropping it, for example, in the root directory of your build you need to configure the plugin to use it:
webdriverBinaries {
driverUrlsConfiguration = resources.text.fromFile('package.json')
}
Note that the driverUrlsConfiguration property is a org.gradle.api.resources.TextResource and can be configured with a text resource from various sources - see javadoc for org.gradle.api.resources.TextResourceFactory for more examples.
Integration with Idea configuration extensions plugin (com.github.erdi.extended-idea)
If Idea configuration extensions plugin is applied to the project together with this plugin it will do the following:
* configure the ideaWorkspace task added to the build by Gradle’s built-in IDEA plugin to depend on configureChromeDriverBinary and configureGeckoDriverBinary tasks
* add system properties specific for the drivers, setting the path to the downloaded binaries as their values, to default JUnit run configuration in IntelliJ when the configuration tasks are executed
The above will ensure that locations of driver binaries are picked up when running tests from IntelliJ.