Selenium Grid

Selenium Grid is a part of the Selenium Suite that specializes on running multiple tests across different browsers, operating systems, and machines in parallel.

When to Use Selenium Grid

Run your tests against different browsers, operating systems, and machines all at the same time Save time in the execution of your test suites

The Hub

  • The hub is the central point where you load your tests into.

  • There should only be one hub in a grid.

  • The hub is launched only on a single machine, say, a computer whose O.S is Windows 7 and whose browser is IE.

  • The machine containing the hub is where the tests will be run, but you will see the browser being automated on the node.

The Nodes

  • Nodes are the Selenium instances that will execute the tests that you loaded on the hub.

  • There can be one or more nodes in a grid.

  • Nodes can be launched on multiple machines with different platforms and browsers.

  • The machines running the nodes need not be the same platform as that of the hub.

How to Configure and Use Grid Download the selenium-server-standalone jar file -In Hub On the command prompt, type java -jar selenium-server-standalone-2.48.2.jar -role hub The hub should successfully be launched - In Node Register Node java -jar selenium-server-standalone-2.48.2.jar -role webdriver -hub http:// 192.168.1.30:4444/grid/register

Designing Test Scripts'

To design test scripts that will run on the grid, we need to use DesiredCapabilites and the RemoteWebDriver objects.

  • DesiredCapabilites is used to set the type of browser and OS that we will automate

  • RemoteWebDriver is used to set which node (or machine) that our test will run against. Go to the Grid's web interface and hover on an image of the browser that you want to automate. Take note of the platform and the browserName

Last updated