Create Node and Hub in Selenium Grid

In Selenium Grid, you can create the Central Hub and You can connect the various machines to this Hub and run your Test Cases parallel on these machines, these machines known as Node. Let’s see, How can you Create Node and Hub in Selenium Grid.


What are Hub and Node?

Selenium Grid Hub – Hub is the central point to the entire GRID Architecture which receives all requests. There is only one hub in the selenium grid. Hub distributes the test cases across each node.


Selenium Grid Node – There can be multiple nodes in Grid. Tests will run in nodes. Each node communicates with the Hub and performs test assigned to it. There can be one or more nodes in a grid. Nodes can be launched on multiple machines with different platforms and browsers.


When you are playing around the Hub and Nodes, please be careful about the port numbers. Selenium Grid Central hub by default launches on port 4444. Similarly, on each node a unique port assign on which Selenium Run.


On each node, we can open the different browser. The single browser can be open on one node. Using this way, you can run single Test case at the same time on different browsers.

You can also Run multiple Browsers on the node, it all depends on your configuration. We will see it later.

On one machine you can open multiple nodes.


Create HUB in Selenium Grid?

In the Last tutorial, We have seen how can we install and run the Selenium grid. To start the hub we need to follow the following steps –


  • Open the command prompt.
  • Go to the directory, where you kept your selenium standalone server jar file. (For details refer the previous tutorial)
  • Now fire the below command-
    java -jar selenium-server-standalone-2.53.0.jar -role hub


Here selenium-server-standalone-2.53.0.jar is my jar file name. If you are using the different version then you can change it and fire to start the Hub. After firing this command, you will get the screen like below –

Create Hub in Selenium Grid


Create Node in Selenium Grid

To create the Node, Go to the other machine where you intend to setup Nodes or on the same machine because we can create the hub and nodes on the same machine as well.

  • To create the Node, First create or start the HUB.
  • To create the node, Open the command prompt.
  • Go to the directory where your selenium server is present and fire the below command-
    java -jar selenium-server-standalone-2.53.0.jar -role webdriver
    -hub http://localhost:4444/grid/register -port 5556


We are running the Node and Hub on the same machine that’s why we are providing the localhost in our command.

If you want to create the node at different machine then-then at the place of localhost you need to place the IP Address of Hub Machine.

Like – java -jar selenium-server-standalone-2.53.0.jar -role webdriver

-hub -port 5556


Using this command we are creating the Node at port 5556. You will get the below message or screen –

Create Node in Selenium Grid


You can also check on Grid Web Interface Console that Node is created or not. Open the Grid Web Console using http://localhost:4444/grid/console , Here you can see the created node. It will look like-

Create Node in Selenium


In the web console, we are getting Browser icons. They are indicating that on this node can work on 5 Mozilla’s, 5 Chromes and 1 instance of IE browser.

This is something, What we are getting by default. We can change the Number of Browsers on the node.


In this way, we can create the Hub and Node in Selenium Grid. Later we will see how can we invoke the Web Browser on any Node.

0 Comment

Leave a Reply