Home » Software Testing » Selenium Grid Tutorial: running hub and nodes using json
Selenium Grid Console with port parameter

Selenium Grid Tutorial: running hub and nodes using json

This post is just the continuation of last two post

    1. Selenium Grid Tutorial : Setting up hub and node

IT Certification Category (English)728x90

  1. Playing with node registration parameters in grid

In these two post, we have learned how to launch hub and node using a command line and have also seen how to use parameters efficiently. But in this post, we are going to see how to use JSON files to run your hub and nodes.

1- We need to create json file for hub and node. Now we are going to see the json that is needed for hub.
a) Open any text editor like notepad or textedit.
b) Past content in editor from JSON for Hub code block.
c) Save this with hub.json in same place where you have your selenium-server-standalone jar file
JSON for Hub

you can fine it at this place.

In the same fashion we can create json file for node and this would look like this, In this we are going to give value for browserName, version and platform as well in this json file and will save it as node.json
JSON for node

above json has been divided in two part first part takes all the parameter that we can set using desiredcapabilities for any browser and second section contains all the configuration related stuff.

IT Certification Category (English)728x90

2- Once we are done with hub and node json file creation.Follow the following steps to run hub and node

1- Open CMD/terminal, navigate to the place where the selenium-server-standalone jar is present.
2- Type following command

and hit enter it will start your hub and to check this go to http://localhost:444/grid/console.

Selenium grid console

So if you have gone through previous post then you would come to know that -hubConfig is new parameter that is being followed by the json file that has been created for hub.

1- As we have seen in case of hub, we need to open cmd/terminal and need to navigate to location of selenium-server-standalone jar
2- Run following command

above command would register node with hub and all browser instances and session detail would be present in node.json.

This can be seen on http://localhost:4444/grid/console

Selenium Grid Console with port parameter

2 thoughts on “Selenium Grid Tutorial: running hub and nodes using json”

  1. Pingback: Testing Bits – 1/17/16 – 1/23/16 | Testing Curator Blog

  2. Hi,

    Here if i try changing the port from 5555 to say 6000, in the node.json file , it still picks up 5555 and i get an error as i have already been running a node on 5555.
    Is there any other way where in i can change the port in the json file it reflects .

    Whereas if i pass the port in command line along with the json file it works
    java -jar selenium-server-standalone-3.0.0-beta3.jar -role node -nodeConfig Node1.json -port 8888

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
%d bloggers like this: