Example that shows how to implement a Selenium Grid capability matcher, implementation of a tutorial that can be found here.
It will be placed in the target folder
$ mvn -DskipTests=true package
- Download Selenium Server
$ wget http://selenium-release.storage.googleapis.com/2.53/selenium-server-standalone-2.53.0.jar
- Start the hub with a the specific configuration
$ java -cp selenium-server-standalone-2.53.0.jar:target/custom-capability-matcher-1.0-SNAPSHOT.jar org.openqa.grid.selenium.GridLauncher -role hub -hubConfig src/main/resources/hubConfig.json
- Start the
foo
node
$ java -jar selenium-server-standalone-2.53.0.jar -role node -hub http://localhost:4444/grid/register -nodeConfig src/main/resources/nodeConfig_foo.json
- Start the
bar
node
$ java -jar selenium-server-standalone-2.53.0.jar -role node -hub http://localhost:4444/grid/register -nodeConfig src/main/resources/nodeConfig_bar.json
$ mvn test
Change this line to see the matcher in action by:
- Either setting
nodeName
capability tofoo
orbar
and see the test getting executed in the desired node. - Removing the
nodeName
capability and letting theDefaultCapabilityMatcher
decide. - Or setting
nodeName
to a different value and seeing the Grid reject the request because no node matches the capabilities.