Cross Browser Testing using Selenium Grid

Let’s see, How can you perform Cross Browser Testing using Selenium Grid. In previous tutorials, You have seen the Basics of Selenium Grid. Now let’s see how can you use the Grid for your Test Execution.


In this tutorial you will see, How can we execute the single Test on multiple Browsers on single Node in Selenium Grid.

You have seen, Selenium Grid has the Capability to open Multiple Browsers on single Node. We have created the multiple instances of multiple browsers on the single node.


Objective – Execute the single Test on Multiple Browsers on the Same Node.

First, you need to decide, how can you perform this. In the last tutorial, we have designed Yahoo Test case. We will use the same as reference Test Case and execute that on firefox, chrome, and IE. First, let’s see the Test Script.


Let’s understand what are you doing in the above code-

  • First, you are deciding which Browser will be passed to desiredCapabilities object. Browser name you are getting dynamically using data provider.
  • Later you invoke the browser based on desiredCapabilities.
  • Later you implemented the Test Code for the test case.
  • At last, You have created a Data Provider, Which has 3 rows and 1 column and which contain the Browser name only.
  • In the Test, You are using this DataProvider.


Now Question is, How can we Execute this using Selenium Grid?

To execute the Test Scripts, We need to follow the below steps.


  1. Invoke the Selenium Grid Hub. You have learned it in Create Node and Hub Tutorial.
  2. Later Invoke the Node with chrome and IE configuration. You have learned this as well in Configure chrome & IE Driver with selenium Grid.To invoke the all three browsers on the same node you can use this command –
    java\chromedriver\chromedriver.exe\IEDriverServer\IEDriverServer.exe -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

    Note – In above command, chrome and IE driver path is my local machine path, Once you will run this on your machine, you need to change it as per your convenience.

    Have you noticed, here in your Test Script, We didn’t configure the chrome and IE driver paths to invoke them? Do you know why ?
    Because we have configured these with the node, when did invoke the node. So now no need to provide the path again in the scripts.

  3. Now the only thing you need to do is, Run your test using your testng.xml file.


Now you can see, It will open all browsers one by one and run your test. You will check your Test Report as well.



0 Comment

Leave a Reply