An end-to-end documentation on Grid
Image Courtesy: Boloji.com
Lets say you have worked on building support for a new browser variant such as Vivaldi and Lets say using Java you have successfully built :
RemoteWebDriver
and which will be used by users in their tests ]Now you would like to extend this support so that your users can run their Vivaldi based selenium tests in a Grid environment. Wondering what to do ?
Its pretty simple. All that Selenium expects you to do is the following :
Create a file with its name as org.openqa.selenium.remote.server.DriverProvider
and place it within a folder named META-INF/services
. Inside this file, refer to the class that basically implements org.openqa.selenium.remote.server.DriverProvider
(or) which extends org.openqa.selenium.remote.server.DefaultDriverProvider
. And yes, you guessed it right again, this is the Service Loader approach that Selenium is using here.
See here for one such sample file and see here for an actual implementation of DriverProvider
interface.
Now spin off your Selenium node using a command such as below. Here we are assuming that our jar which contains the Vivaldi
browser’s client bindings is vivaldi-browser.jar
.
java -cp vivaldi-browser.jar:selenium-server-standalone-3.141.59.jar \
org.openqa.grid.selenium.GridLauncherV3 -role node
If you are on Windows environment, then the command would be :
java -cp simple-proxy.jar;selenium-server-standalone-3.141.59.jar \
org.openqa.grid.selenium.GridLauncherV3 -role node
Tip:
;
as a separator between the two jar names. On Windows ;
is a valid path separator and on non windows, its :
.java -cp
we have to specify the class name that contains the main()
method. And yes you guessed it right. org.openqa.grid.selenium.GridLauncherV3
contains the main()
method.And that’s it, you now have enabled support for your new web browser in selenium grid.