Selenium Grid | Configuration and implementation with Example.

As the name sounds ‘Grid’ which is a combination of parallel lines. Hence, technically it stands for parallel execution of test cases using Selenium on multiple browsers and platforms.

Architecture of Grid

Selenium Grid works on the hub-node concept similar to the server-client.

Hub: The hub is the center point or we can say acts as a server, where we can generate all test cases, frameworks. This is the place where we can configure user requirements like:

  • How many test cases need to be run?
  • Which platform would be used for the execution?
  • Which browser would be used for the execution?
  • Test data can be passed using Hub.

Nodes: On the other hand nodes are the Selenium instances which would be used to run the test cases from the hub.

Architecture of Grid
Architecture of Grid

1. Latest JRE/JDK and configure build path in the environment variable.

2. Latest standalone selenium server jar files. Selenium-server-standalone-2.44.0.jar

3. The latest version of webdriver for chrome, firefox or IE as per requirement.

Step #1: Installation

1. Install latest JRE/JDK and configure build path in the environment variable.

2. Download latest standalone selenium server jar files. Selenium-server-standalone-2.44.0.jar

WARNING: Be sure to turn off the firewalls on the machine running your hub and nodes. Otherwise, you may get connection errors.

Step #2: On Hub Server(Machine)

1. Open the command prompt.

2. To verify that jdk/jre are configured correctly and working properly execute the following command:

c:>java -version [If the version is incorrect or any error is appearing the follow below steps:

a. Navigate to ‘bin’ folder of the jre where it has been installed.

b. execute the command:-

c:Program FilesJavajrebin>java

3. Now copy the selenium-server-standalone-2.44.0.jar file in the bin folder.

4. Now execute the following command to start Hub:-

c:Program FilesJavajrebin>java -jar selenium-server-standalone-<version>.jar -role hub

5. The hub will automatically start-up using port 4444 by default.

Additional Notes:

     The user can specify the port using “java -jar selenium-server-standalone-2.44.0.jar -role hub -port 4441” command.

     You can view the status of the hub by opening a browser window and navigating to http://localhost:4444/grid/console

1. Also, this window shows all the information about all the nodes registers to this grid hub.

2. On Mouse hovering any browser icon on this page shows the Operating system, browser name in the tool tip.


Contains all the information about hub and node. In the web, console navigate to ‘Configuration‘ tab.

Use the correct information of hub and node from here.

Mainly it contains ip address and port of the both hub and host










Step #3: Start the Node(on Client Machine)

1. Follow steps #1 to 3 as it is on Node machine.[From above section Step #2: On Hub Server(Machine)]

2. Copy the executable files of webdrivers (chromedriver.exe, geckodriver.exe,iedriver.exe) on the node at any location. Suppose keep them in C:

3. Now execute the following command to start Node:-

c:Program FilesJavajrebin>java -jar”C:chromedriver.exe” selenium-server-standalone-3.0.1.jar -role node -hub

In the above statement10.11.1.189:’ would be the IP address of Hub

C:chromedriver.exe: the Complete path of the chromedriver.exe file on node machines.

Additional Notes:

Creating Sessions:

c:Program FilesJavajrebin>java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register -browser browserName=firefox,maxInstances=5,maxSession=2

To set path on node of the browser drivers.”C:chromedriver.exe

Step #4: Create and execute the Script on Hub(Server)

1. On the hub(server) machine, open eclipse.

2. Create a test project and copy the below-mentioned code in the class file.

3. Execute the code.

Example of Code:

public class GridExampleTest
   public static void main() throws MalformedURLException
      DesiredCapabilities capabilities = DesiredCapabilities.firefox();

      /* System.setProperty("webdriver.gecko.driver","C:\geckodriver.exe");

      RemoteWebDriver driver = new RemoteWebDriver(new URL(
              "http:<ip address of node>:5555/wd/hub"), capabilities);

<ip address of node>: Information regarding the associated nodes should be verified using

URL: http://localhost:4444/grid/console on Hub Machine.

Summary of the Tutorial:

1. Selenium Grid is used to run multiple tests simultaneously on different browsers and platforms.

2. 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.

3. To install Selenium Grid, you only need to download the Selenium Server jar files.

4. There are 2 ways to verify if the hub is running: one was through the command prompt, and the other was through a browser

5. To run test scripts on the Grid, you should use the DesiredCapabilities and the RemoteWebDriver objects in our test case programs.

— 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.

2238total visits,1visits today

2 thoughts on “Selenium Grid | Configuration and implementation with Example.”

  1. This is really interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your magnificent post. Also, I’ve shared your website in my social networks!|

Leave a Reply

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