Running hub and nodes using json file

Now if we dont want to run the lengthy commands as we did earlier to start a hub and then number of nodes on our pc like how many browers we want to run etc we can simply create hub.json and node.json files .In those files we can define whether node1 wants to run firefox or chrome or both and same for node 2.

Then to start hub and nodes on our system all we have to do is in cmd we have to go to the location where selenium standalone driver is lying and then type commands

For hub we type the below. We basically provide the hub config file in below command -nodeConfig hub.json

cd c:\Seleniumstandalone 

java -jar selenium-server-standalone-2.48.2.jar -role hub -nodeConfig hub.json 

Then we open a new cmd window and for node1 we type the below. We basically provide the hub config file in below command -nodeConfig node1.json

cd c:\Seleniumstandalone java -Dwebdriver.gecko.driver="C:\drivers\geckodriver.exe" -Dwebdriver.chrome.driver="C:\drivers\chromedriver.exe" -jar selenium-server-standalone-3.0.1jar -role node -nodeConfig C:\grid\node1.json

For node2 we type the below in a new window

cd c:\Seleniumstandalone java -Dwebdriver.gecko.driver="C:\drivers\geckodriver.exe" -Dwebdriver.chrome.driver="C:\drivers\chromedriver.exe" -jar selenium-server-standalone-3.0.1.jar -role node -nodeConfig C:\grid\node2.json