Define Browser Instance on Node in Selenium Grid

In this tutorial, You will see, How can you define Browser Instance on Node 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.

In this tutorial we will see, How can we open the Browser on the node, How can we decide the Number of browsers on the Node and the Type of Browser on the Node.

 

We have seen Grid was creating 5 instances of Mozilla, 5 of Chrome and 1 of IE by default. Now you will see, How can you manage these instances.

To open the Node, Please refer the tutorial Create Node & Hub in Selenium Grid.

 

How to Decide No. of Browsers on Node

In the previous tutorial we have seen, How can be open the desired browser on the node. To open the Browser on node we need to append the command –

-browser browserName=firefox

 

So suppose, We want to open only one instance of Firefox on the node. Now you need to run your Hub and fire the below command to open the node –

java -jar selenium-server-standalone-2.53.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5556 -browser browserName=firefox

Note –  Mention the IP Adress of your Hub in the place of localhost:4444 , If your HUB is another machine.

 

This will open the only one instance of FireFox on Node. You can verify this by open the Grid Web Console.

Open Browser in Selenium Grid

 

How to Open Multiple Browser on One Node

Now we will see, How can we open the multiple Browsers on the single node. To open the Browsers on the node you need to append the command in the Node open command.

 

Commands to open multiple Browsers on Node-

1. Only Firefox 

java -jar selenium-server-standalone-2.53.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5556 -browser browserName=firefox

 

2. One Instance of FireFox and One Instance of Chrome

java -jar selenium-server-standalone-2.53.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5556 -browser browserName=firefox -browser browserName=chrome

 

 

3. One instance of Firefox and one instance of IE

java -jar selenium-server-standalone-2.53.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5556 -browser browserName=firefox -browser browserName=iexplore

 

4. Open single instance of firefox, chrome & IE

java -jar selenium-server-standalone-2.53.0.jar -role webdriver -hub http://localhost:4444/grid/register -port 5556 -browser browserName=firefox -browser browserName=iexplore -browser browserName=chrome

 

You have seen, How can we create the instance of Browsers on Node in Selenium Grid. you can verify this using Grid Web Console.

Create Node in Selenium Grid

 

Here we can see, Only one instance is available for every browser.

Like this we can decide and control, Which browser we can open on the node.

0 Comment

Leave a Reply