Selenium Grid :
  1. Grid is a selenium advanced tool that distributes the tests across multiple physical/Remote machines so that we can execute scripts in parallel.
  2. Grid uses the same code which is placed in HUB machine, hence the code need NOT be present on the system they execute

Basics of Selenium Grid:
Hub:
  1. Hub is central point to the entire GRID Architecture which receives all requests.
  2. There is only one hub in the selenium grid. Hub distributes the test cases across each node.
  3. In simple words, Hub means the machine where you put your source code.
Node:
  1. There can be multiple nodes in Grid.
  2. Tests will run in nodes. Each node communicates with the Hub and performs test assigned to it.
  3. In simple words, nodes means your remote virtual machines where your test cases execution takes place.

Steps to Configure Selenium Grid:
Step 1: Download Selenium Server jar file from Selenium’s official website here http://docs.seleniumhq.org/download/

Step 2:
After download the jar, navigate to the folder location where you placed your downloaded Selenium-server-standalone jar.

For example, After downloaded the jar by default jar will present in downloads folder
Lets assume jar present in “c:/MachineA/downloads” location.

Step 3:
Open command prompt, navigate upto downloaded server location path like below:

How to Run HUB commands in command prompt:(Machine A)
  1. In Machine A I want to run the HUB
  2. Open cmd prompt and Enter “cd c:/MachineA/downloads”
  3. Now copy your downloaded jar name (Ex: selenium-server-standalone-2.41.0)
  4. Now Enter command “java -jar <<paste your downloaded jar name>>.jar -role hub
    • Example : java -jar selenium-server-standalone-2.41.0.jar -role hub
  1. Click Enter Button


How to Run Node commands in command prompt:(Machine B)
  1. Login to Machine B,I want to run the Node
  2. Open cmd prompt and Enter your downloaded jar path “cd c:/MachineB/dowloads
  3. Now copy your downloaded jar name (Ex: selenium-server-standalone-2.41.0)
  4. Now Enter commandjava -jar <<paste your downloaded jar name>>.jar -role node -hub http://<<Machine A Ip Address>>:4444/grid/register”
    • Example : java -jar selenium-server-standalone-2.41.0.jar -role node -hub http://120.23.104.00:4444/grid/register

In Machine A (where HUB running):
Once you are done your above HUB and Node steps, we can see the HUB

running status by opening your
firefox or Chrome browser and access this
 

  • Example : http:// 120.23.104.00:4444/grid/console


This indicates that By default you can use (selenium grid)
  • 5 Chrome
  • 5 Firefox
  • 1 IE browser
Note: if you are running HUB and Node commands in same machine, you can give localhost in below Node command like below

  1. HUB command is same as mentioned above
  2. Node command:
    • java -jar <<paste your downloaded jar name>>.jar -role node -hub http://localhost:4444/grid/register
We can see the HUB running status by opening your firefox or Chrome browser and access this

http:// localhost:4444/grid/console

Categories: