Monday 20 May 2013

How to setup Selenium grid

Selenium Grid:


Selenium grid concept is used to distribute test cases and run multiple test cases at the same time in
  • The same machine - same browsers/ different browsers
  • Different machines - same browsers/ different browsers
  • Different OS etc.
While reading about selenium grid you could have seen two technical terms names hub and node mainly.

Hub is a central point, which allocates the available browsers to the nodes
Node is nothing but, it is an instance which  needs to be registered in the hub.

Grid Set up:

  1. Run tests cases in the same machine
  2. Run test cases in different machines

Run tests cases in the same machine:

I have two tests in the xml suite file. I want to run these two tests parallel in the same machine.

Step 1: Start the hub


Open the command prompt and go to the directory where the selenium-server.jar is available. Then type the following command and hit the enter.

                  java -jar selenium-server.jar -role hub

Here we are starting the selenium server with the hub role. It starts at the port 4444 as default. If you want to start the hub in different port you can use the parameter -port ( java -jar selenium-server.jar -role hub -port 6666)

Now hub is started and if you go to this link http://localhost:4444 you will see the grid details

Step 2: Create/Register node in hub


Open the command prompt and go to the directory where the selenium-server.jar is available. Then type the following command and hit the enter.

                  java -jar selenium-server.jar -role node -hub http://localhost:4444/grid/register

This will register the node with the hub. Now if you look http://localhost:4444/grid/console you will the available browsers for our test.

Also you can particularly specify the browser name, maximum instances, port and rc/webdriver etc as below,

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














2 comments:

  1. Appium Training in chennai
    We provides Best Appium Training in Chennai with real time project assistance by our leading Appium mobile App Automation testing architect
    For Free Live Demo @ Call to 8122241286.
    Appium ,Selenium,Mobile Automation Testiing using Android and IOS
    www.thecreatingexperts.com
    Appium training in chennai

    ReplyDelete