Fork me on GitHub

Usage

Installing the Latest Drivers

To install the latest drivers for the current platform and the most probable bit version add the plugin configured to execute the install-drivers goal.

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Note that the plugin will automatically update the driver if a newer driver version is released.

Installing Specific Drivers

If you wish to be more specific about which drivers to install you can provide the drivers yourself in the plugin configuration.

E.g. to install specific versions of all available drivers

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <drivers>
            <driver>
                <name>internetexplorerdriver</name>
                <platform>windows</platform>
                <bit>32</bit>
                <version>3.9.0</version>
            </driver>
            <driver>
                <name>internetexplorerdriver</name>
                <platform>windows</platform>
                <bit>64</bit>
                <version>3.9.0</version>
            </driver>
            <driver>
                <name>chromedriver</name>
                <platform>windows</platform>
                <bit>32</bit>
                <version>74.0.3729.6</version>
            </driver>
            <driver>
                <name>chromedriver</name>
                <platform>mac</platform>
                <bit>64</bit>
                <version>74.0.3729.6</version>
            </driver>
            <driver>
                <name>chromedriver</name>
                <platform>linux</platform>
                <bit>64</bit>
                <version>74.0.3729.6</version>
            </driver>
            <driver>
                <name>phantomjs</name>
                <platform>windows</platform>
                <bit>64</bit>
                <version>2.1.1</version>
            </driver>
            <driver>
                <name>phantomjs</name>
                <platform>mac</platform>
                <bit>64</bit>
                <version>2.1.1</version>
            </driver>
            <driver>
                <name>phantomjs</name>
                <platform>linux</platform>
                <bit>32</bit>
                <version>2.1.1</version>
            </driver>
            <driver>
                <name>phantomjs</name>
                <platform>linux</platform>
                <bit>64</bit>
                <version>2.1.1</version>
            </driver>
            <driver>
                <name>geckodriver</name>
                <platform>windows</platform>
                <bit>64</bit>
                <version>0.24.0</version>
            </driver>
            <driver>
                <name>geckodriver</name>
                <platform>windows</platform>
                <bit>32</bit>
                <version>0.24.0</version>
            </driver>
            <driver>
                <name>geckodriver</name>
                <platform>mac</platform>
                <bit>64</bit>
                <version>0.24.0</version>
            </driver>
            <driver>
                <name>geckodriver</name>
                <platform>linux</platform>
                <bit>64</bit>
                <version>0.24.0</version>
            </driver>
            <driver>
                <name>geckodriver</name>
                <platform>linux</platform>
                <bit>32</bit>
                <version>0.24.0</version>
            </driver>
            <driver>
                <name>edgedriver</name>
                <platform>windows</platform>
                <bit>64</bit>
                <version>6.17134</version>
            </driver>
            <driver>
                <name>operadriver</name>
                <platform>windows</platform>
                <bit>32</bit>
                <version>2.30</version>
            </driver>
            <driver>
                <name>operadriver</name>
                <platform>windows</platform>
                <bit>64</bit>
                <version>2.30</version>
            </driver>
            <driver>
                <name>operadriver</name>
                <platform>mac</platform>
                <bit>64</bit>
                <version>2.30</version>
            </driver>
            <driver>
                <name>operadriver</name>
                <platform>linux</platform>
                <bit>64</bit>
                <version>2.30</version>
            </driver>
        </drivers>
    </configuration>
</plugin>

If you wish to make sure that you always have the latest driver installed omit the version of the driver. For more detailed driver configuration possibilities see the plugin goal documentation.

Installing a Driver from an URL

If the driver is not available in the default drivers repository-3.0.json file you can install the driver by also providing an URL to the download location.

E.g. to install an old Chrome Driver for windows

<driver>
    <name>chromedriver</name>
    <platform>windows</platform>
    <bit>32</bit>
    <version>2.27</version>
    <url>http://chromedriver.storage.googleapis.com/2.27/chromedriver_win32.zip</url>
</driver>

Selecting files to extract

When installing a custom driver you can select what files should be extracted from the downloaded zip/bz2 file. This is done by providing a regex pattern in a tag named <fileMatchInside>.

<driver>
    <name>phantomjs</name>
    <platform>linux</platform>
    <bit>32</bit>
    <version>2.1.1</version>
    <url>https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.6-linux-i686.tar.bz2</url>
    <fileMatchInside>.*/bin/phantomjs$</fileMatchInside>
</driver>

Changing the Installation Directory

By default the drivers are installed a directory called drivers in the maven project root (${basedir}/drivers). To install the drivers to another directory specify the custom path through the configuration parameter named installationDirectory.

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <installationDirectory>/Users/andidev/drivers</installationDirectory>
        <drivers>
            ... drivers to install
        </drivers>
    </configuration>
</plugin>

Keeping downloaded data in the cache

To avoid downloading the drivers more than once if you switch between driver versions or something similar you could set <keepDownloadedWebdrivers>true</keepDownloadedWebdrivers> configuration paramter. Please note that you must also provide a fixed path for pluginWorkingDirectory otherwise keepDownloadedWebdrivers=true will be ignored!

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <keepDownloadedWebdrivers>true</keepDownloadedWebdrivers>
        <pluginWorkingDirectory>/some/directory</pluginWorkingDirectory>
        <drivers>
            ... drivers to install
        </drivers>
    </configuration>
</plugin>

Using a proxy

If you have configured a proxy in the settings.xml file the first encountered active proxy will be used. To specify a specific proxy to use you can provide the proxy id in the configuration.

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <proxyId>yourproxyid</proxyId>
    </configuration>
</plugin>

Skipping the driver installation

To skip the installation you can add <skip>true</skip> in the configuration tag.

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <skip>true</skip>
        <drivers>
            ... drivers to install
        </drivers>
    </configuration>
</plugin>

Setting the driver filename

To set a custom file name for the specified driver configuration.

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <drivers>
            <driver>
                <name>chromedriver</name>
                <platform>linux</platform>
                <customFileName>chrome-linux-custom</customFileName>
            </driver>
        </drivers>
    </configuration>
</plugin>

Setting a custom repository URL

To set a custom URL to the JSON repository file. The supported URL schemes are: http, https and file. The content of the file must validate against the drivers repository JSON schema.

Example for local file

<plugin>
    <groupId>com.github.webdriverextensions</groupId>
    <artifactId>webdriverextensions-maven-plugin</artifactId>
    <version>4.0.0</version>
    <executions>
        <execution>
            <goals>
                <goal>install-drivers</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <repositoryUrl>file:///some/path/to/repo.json</repositoryUrl>
    </configuration>
</plugin>

Further Configurations

For more details on how to further configure this plugin please see the plugin goal documentation.