Monday, August 12, 2013

Introduction to Selenium Grid

What is 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.

Selenium Grid has 2 versions –
Grid 1 and Grid 2.

Use of Selenium Grid


Run your tests on different browsers, operating systems, and machines all at the same time. This will ensure that the application you are testing is fully compatible with a wide range of browser and OS combinations.
    Save time in execution of your test suites. If you set up Selenium Grid to run, say, 4 tests at a time, then you would be able to finish the whole suite around 4 times faster.

Difference between Grid 1.0 and Grid 2.0


Grid 1.0

1. Selenium Grid 1 has its own remote control that is different from the Selenium RC server.
2. You need to install and configure Apache Ant first before you can use Grid 1.
3. Can only support Selenium RC commands/scripts.
4. You can only automate one browser per remote control.


Grid 2.0

1. Selenium Grid 2 is now bundled with the Selenium Server jar file
2. You do not need to install Apache Ant in Grid 2.
3. Can support both Selenium RC and WebDriver scripts.
4. One remote control can automate up to 5 browsers.


 Hub and Node


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

  • Only one hub should be in a grid.
  • The hub is launched only on a single machine.
    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.


Selenium Grid is used to run multiple tests simultaneously in different browsers and platforms.
  • Grid uses the hub-node concept.
  • The hub is the central point wherein you load your tests.
  • Nodes are the Selenium instances that will execute the tests that you loaded on the hub.
  • To install Selenium Grid, you only need to download the Selenium Server jar file – the same file used in running Selenium RC tests.
  • There are 2 ways to verify if the hub is running: one was through the command prompt, and the other was through a browser
  • To run test scripts on the Grid, you should use the DesiredCapabilities 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.

No comments: