selenium grid tutorial code example

Example 1: selenium grid

Selenium Grid can be used to execute 
same or different test scripts on
multiple platforms and browsers
concurrently so as to achieve distributed test execution.

It allows running test cases in parallel
thereby saving test execution time.
It allows multi-browser testing.
It allows multi-OS testing.
It allows multi-platform testing (desktop, mobile).

Example 2: selenium grid configuration

java -jar selenium-server-standalone-2.53.1.jar -role hub -hubConfig hubconfig.json

Example 3: selenium grid configuration

{
	  "port": 4444,
	  "newSessionWaitTimeout": -1,
	  "servlets" : [],
	  "withoutServlets": [],
	  "custom": {},
	  "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
	  "registryClass": "org.openqa.grid.internal.DefaultGridRegistry",
	  "throwOnCapabilityNotPresent": true,
	  "cleanUpCycle": 5000,
	  "role": "hub",
	  "debug": false,
	  "browserTimeout": 0,
	  "timeout": 1800
}

Example 4: how selenium grid looks like

-it's a java program looks like jar file
-we run this jar from 2 roles: hub and node
-hub receives commands Webdriver object of the client
-then hub is looking for available nodes 
 for execution.
-nodes are executing tests