WebDriver Grid Tutorial – Setting up Script using RemoteWebDriver

This is Part 7 of the Selenium WebDriver Tutorial Series. Check out Part 6 for Setting Up WebDriver with Maven.

WebDriver Grid RemoteWebDriver

WebDriver Grid allows you run your tests on different machines against different browsers in parallel thus reducing the total time of execution. This tutorial explains how to run your tests using RemoteWebDriver in Grid mode.

When to use Grid?

  • When you have to run your tests against multiple browsers, multiple browser versions, or on different operating systems.
  • To reduce the total execution time

What is Hub and Nodes?

Hub is the controller that will receive all the test request and distribute them the the right nodes. When the hub is started, it starts using port 4444 (can be changed) to which the nodes will be registered.

Configuring Hub

Hub can be started using the below code : [Run it in the folder you have the selenium standalone jar]

You can view the status of the hub by navigating to: http://localhost:4444/grid/console

Configuring Hub with JSON

A sample hubconfig.json file can be seen here. You can modify the file and use.

Configuring Nodes

Nodes are started once the hub is started and it registers itself to the hub.

Note that if the hub is running in another machine, replace localhost with the hostname or ip address of that server.
Additional parameters can be added to provide the browser information as shown below.

SEE ALSO:   How to Create Selenium WebDriver Automation Framework

Configure for Firefox

Configure for Chrome

The below image shows the grid console at http://localhost:4444/grid/console

RemoteWebDriver Grid Console

Configuring the nodes by JSON

Node can be configured using json config file as shown below.

A sample nodeconfig file can be seen here.


RemoteWebDriver is need to run our test scripts in Grid mode. It has a server and a client of which the server part was seen in above section. The client is the component which executes the test scripts in your system and gets communicates with the server.
Let’s see how to setup scripts using RemoteWebDriver.

We have to setup the DesiredCapabilities based on the browser and initialize the RemoteWebDriver object with it. After obtaining the webdriver object, you can use it in a regular way.

SEE ALSO:   Solutions to 5 Common WebDriver Doubts

Next Post : WebDriver File Upload

Further Reading:

You may also like...

Leave a Reply

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