Details of Selenium Grid - Selenium Webdriver Trainings

Selenium grid is a component of selenium testing suite that helps to distribute tests across multiple platforms and browsers. In other words, this is the component of selenium that allows performing multiple, parallel tests at the same time and thus selenium grid helps to reduce the time consumption for testing.

Selenium Grid Architecture

Selenium grid has a hub and several nodes. Hub can be called as a server, the central point where the tests are initiated. A selenium grid has only one hub, the same can be launched on a single machine.

At the same time, a selenium grid can have multiple nodes which execute tests that are initiated in the hub. These nodes can have any OS or browser supported by selenium.

Working with Hub

Certain protocols should be followed to work with grid and some of the steps are given below.

  • Configuring the hub
  • Configuring the nodes
  • Developing the script and preparing the XML file
  • Execution of test
  • Analysis of reports

Configuring the Hub

  1. Download the latest selenium server standalone JAR file from http://docs.seleniumhq.org/download/.
  2. Hub can be started by launching the selenium server. Port “4444” can be used to start the hub. You should ensure that the port 4444 is not used for any other programs.
  3. Then open the browser and go to the URL http//localhost:4444
  4. Now, click on the ‘console’ link and click ‘view config’. The configuration of the hub is displayed.

Configuring the Nodes

  1. Select the node where the scripts are to be executed and log on to the node. Now, place the selenium server 2.42.4 in a folder. Selenium-server-standalone should be pointed when the nodes are launched.
  2. Firefox node to be launched using the following command.

java -jar D:\JAR\selenium-server-standalone-2.42.2.jar -role node -hub http://10.30.217.157:4444/grid/register -browser browserName=firefox -port 5555

Where,
D:\JAR\selenium-server-standalone-2.42.2.jar = Location of the Selenium Server Standalone Jar File(on the Node Machine)
http://10.30.217.157:4444 = IP Address of the Hub and 4444 is the port of the Hub
browserName = firefox (Parameter to specify the Browser name on Nodes)
5555 = Port on which Firefox Node would be up and running.

  1. After the execution of the command, go back to the hub. Go to http://10.30.217.157:4444 and now the hub will display the node attached to it.
  1. Now Internet Explorer node should be launched. Internet Explorer drive should be downloaded on the node machine for this purpose.
  1. Internet explorer drive can be downloaded from  http://docs.seleniumhq.org/download/

   After downloading, unzip it and keep it in a folder to refer while launching IE node.

  1. IE can be launched using the following command

C:\>java -Dwebdriver.ie.driver=D:\IEDriverServer.exe -jar D:\JAR\selenium-server-standalone-2.42.2.jar -role webdriver -hub http://10.30.217.157:4444/grid/register -browser browserName=ie,platform=WINDOWS -port 5558

Where,
D:\IEDriverServer.exe = The location of the downloaded the IE Driver(on the Node Machine)
D:\JAR\selenium-server-standalone-2.42.2.jar = Location of the Selenium Server Standalone Jar File(on the Node Machine)
http://10.30.217.157:4444 = IP Address of the Hub and 4444 is the port of the Hub
browserName = ie (Parameter to specify the Browser name on Nodes)
5558 = Port on which IE Node would be up and running.

  1. Now go to the URL http://10.30.217.157:4444 after coming back to the hub and the hub will be showing the IE node attached to it.
  1. Launching Chrome node is the next step and Chrome drive is needed for this.
  1. Chrome driver version 2.10 can be downloaded from the “Third party browser driver’s area” in the URL http://10.30.217.157:4444
  1. After downloading Chrome Driver, unzip it and keep it in a separate folder.
  1. Chrome can be launched using the following command

    C:\>java -Dwebdriver.chrome.driver=D:\chromedriver.exe -jar D:\JAR\selenium-server-standalone-2.42.2.jar -role webdriver -hub  http://10.30.217.157:4444/grid/register -browser browserName=chrome,platform=WINDOWS -port 5557

Where,
D:\chromedriver.exe = The location of the downloaded the chrome Driver(on the Node Machine)
D:\JAR\selenium-server-standalone-2.42.2.jar = Location of the Selenium Server Standalone Jar File(on the Node Machine)
http://10.30.217.157:4444 = IP Address of the Hub and 4444 is the port of the Hub
browserName = chrome (Parameter to specify the Browser name on Nodes)
5557 = Port on which chrome Node would be up and running.

12. Now, come back to hub and go to the URL http://10.30.217.157:4444 Chrome node will be displayed there.

Leave a Reply

Your email address will not be published. Required fields are marked *