WPSelenium comes with preset urls to download the appropiate version of selenium and the browser drivers. However they might arise a case in which you want to download a particular version of a driver (or add another one) or use an updated version of selenium. In this case you can use the wpSeleniumProvision config endpoint which is highlighted below.
<wpselenium> <siteUrl>http://localhost:3000</siteUrl> <wpSeleniumProvision> <wpSeleniumUrl>[wpSeleniumUrl]</wpSeleniumUrl> <driverUrl> <win> <chrome>[windows_chrome_driver_url]</chrome> <firefox>[windows_firefoce_driver_url]</firefox> </win> <linux> <chrome>[linux_chrome_driver_url]</chrome> <firefox>[linux_firefox_driver_url]</firefox> </linux> </driverUrl> </wpSeleniumProvision> <wpSeleniumPort></wpSeleniumPort> <phpunit bootstrap="vendor/autoload.php"> </phpunit> </wpselenium>
An alternate url to download the selenium server from. The default it is set to http://selenium-release.storage.googleapis.com/3.9/selenium-server-standalone-3.9.1.jar
This configuration is used to specify the download urls of the browser drivers, As can be seen from above, this is specified by giving the download url for the driver under the appropiate OS (win or linux).
If you desire to test on a browser not specified below, you can add the driver name and download url under the appropiate OS. An example of this is below:-
<wpselenium> <siteUrl>http://localhost:3000</siteUrl> <wpSeleniumProvision> <driverUrl> <linux> <opera>https://github.com/operasoftware/operachromiumdriver/releases/download/v.2.42/operadriver_linux64.zip </opera> </linux> </driverUrl> </wpSeleniumProvision> <wpSeleniumPort></wpSeleniumPort> </wpselenium>
WPSelenium will now register this as a possible browser option to run the tests with.
So in the above case we would need to run the command below to test on Opera (given the Opera browser is installed)
Working with newer or older versions of your drivers
There are times you might need to work with older or newer version of your drivers (such as when you update your browser). This usually results in some suggestive errors to this regards when you try to run wpselenium. Using the similar procedure as that above you can point to a updated download url for your driver. WPSelenium will then download the specified driver and use it when running tests. Below is an example of using the the chrome v73 browser drivers instead of the default v74.
<wpselenium> <siteUrl>http://localhost:3000</siteUrl> <wpSeleniumProvision> <driverUrl> <win> <chrome>https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_win32.zip</chrome> </win> </driverUrl> </wpSeleniumProvision> </wpselenium>
- Specifying a browser driver to test with assumes you have the browser installed on your system
- The url to the browser driver must be a zip or tar.gz with the actual driver available in the uncompressed folder (i.e cant be inside a zip of a zip)
- To revert back to the original provisioning config, you just need to remove the
wpSeleniumProvisionoption from your wpselenium.xml config.
Current set URLs
Chrome: https://chromedriver.storage.googleapis.com/76.0.3809.126/chromedriver_win32.zip Firefox: https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win64.zip
Chrome: https://chromedriver.storage.googleapis.com/76.0.3809.126/chromedriver_linux64.zip Firefox: https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz
The port to run the selenium server on. Defaults to 4444.
Notes: As can be seen above you dont need to specify all the advance config points to make modifications, only the ones you need. WPSelenium will merge your config appropiately with its own.
What about MAC support?
In theory WPSelenium should also work on MAC, but this has not been tested yet. If you want to try this on MAC you will need to specify the browser driver url for the browser you want to test under the