Selenium Grid on Windows

In this post, I will describe how to use Selenium Grid. You will learn how to install a selenium grid and how to configure it.

For Mac users, you can check here:

First of all, you can access the Selenium Grid page from the below address.[1]

Selenium Grid allows you to:

  • Scale by distributing tests on several machines ( parallel execution )
  • Manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers / OS.
  • Minimize the maintenance time for the grid by allowing you to implement custom hooks to leverage virtual infrastructure for instance. [1]

Now, please go to and download Selenium Standalone Server. Selenium team constantly updating the versions. You may see a different version, pls do not panic, just download it. ;)

Then, copy the .jar file to C:\Selenium\grid\ folder.

What are Hub and Nodes?

Basically, we have a Hub which is a server that we connect from our tests and we have Nodes, they can be on different machines and they register with the hub. Simply, we have a hub and several nodes, nodes are registered in our hub and the hub knows which browsers are available. Hub sends requests to the nodes based on desired capabilities and executes the tests.

How to Start and Configure Hub and Nodes

The best way to start hub and node with .bat files for Windows also it is easier and tidier to configure them with .json files.

First, let’s start the hub by command window.

Hub Start Command: java -jar selenium-server-standalone-3.0.1.jar -role hub

and you can see the hub panel on your browser as follows.

Let’s start the node

We can start the node with the command window as below command.

Node Start Command: java -jar selenium-server-standalone-3.0.1.jar -role node -hub http://localhost:4444/grid/register

and when you open the grid console you can see that the node registered with the hub.

selenium grid

When we wanted to use a selenium grid in our tests we need to tell our grid where the required browser executable is located. Thus, we should start to the node as below command before writing our tests. We added the blue part.

Node Start Command with Chrome Driver Location: 

java -jar\Selenium\drivers\chrome\chromedriver.exe selenium-server-standalone-3.0.1.jar -role node -hub http://localhost:4444/grid/register 

I wrote a very simple test that clicks the Facebook login button. Before running the below test, start the hub and the node with the above command then run the test.

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;


 * Created by ONUR on 20.11.2016.
public class GridExampleTest {

    static WebDriver driver;

    //Setup Driver
    public static void setupTest() throws MalformedURLException {
        DesiredCapabilities caps =;
        //For Firefox use below capabilities
        //DesiredCapabilities caps = DesiredCapabilities.firefox();
        driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), caps);

    public void T01_FacebookLogin() {
        //Navigate to

        //Login Button
        WebElement loginButton = driver.findElement("loginbutton"));

        //Actions example;

    //Close Driver
    public static void quitDriver() {

Selenium Grid Nodes and Hub Configurations by JSON

It is also described at page as shown below.

Hub Config:

Node Config:

I will use the same config which is located at the above link. By using these configurations I created “starthub.bat” and “startnode.bat” files.


REM start a hub with the defaults on port 4444
REM visit http://localhost:4444/grid/console to see status
REM java -jar selenium-server-standalone-3.0.1.jar -role hub

REM Start a hub with params configured in JSON file
java -jar selenium-server-standalone-3.0.1.jar -role hub -hubConfig hub.json


REM start a node configured by the node.json

java -jar -Dwebdriver.gecko.driver=C:\Selenium\drivers\firefox\geckodriver.exe\Selenium\drivers\chrome\chromedriver.exe selenium-server-standalone-3.0.1.jar -role node -nodeConfig node.json 

Start the HUB

Start the Node

Run the test again! When you run the test you will see that it will pass.

Thanks for reading.

All the best!
Onur Baskirt

4 thoughts on “Selenium Grid on Windows”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.