Selenium Grid Helper

In our previous posts, we talked about Selenium Grid and How to setup a selenium grid and configuration options for hub and nodes.

Most of us would would feel overwhelmed with information [vis-a-vis focusing on test automation] when dealing with the selenium grid and all the configuration options. It looks more like an infrastructure task right. So if we take a step back, what do we really need from a Selenium GRID at the minimum? Among many options, we need.

  • Browser(s) and its version
  • Platform (os)
  • More config options

Hence to make life a little easier to manage a selenium GRID, we wrote Selenium GRID Helper. Let’s see how to use it in detail in this section [We covered it in the previous section on using it with simple options]

Download the Selenium GRID Helper anywhere on your windows machine. I download it to c:\seleniumframework. It is assumed that you have JDK

A video explaining the usage and consumption of a GRID is posted at the end of this section.

HUB script

Double click the START_HUB.bat file. This will start the Selenium GRID Hub on port 4444. Let’s understand the script.

  • %CD% : current directory
  • JAVA_HOME: root directory of JDK
  • PATH: self explanatory
  • SELENIUM_VERSION: Change this value to whatever selenium version you would like to use. The helper has selenium-server-standalone-2.44.0.jar
  • HOST: The host on which the hub is launched. Change this to the ip address if you are spinning up a GRID across multiple machines [Here for demonstration we are using localhost]
  • PORT: Default port on which hub gets launched. You can change this to any available port on the machine

Once you double click the batch script on your local machine, you should see the below


NODE scripts

Node configuration is a little complex than hub. Why? Because node is where we decide the following:

  • What browsers and their versions
  • What webdrivers and their versions
  • Path for browser binaries on the machine
  • How many instances of browsers should the node serve
  • Hub information to register to

Let’s say you want a node that can serve Chrome 39, Firefox 35 and IE 10 browsers. The below script “START_NODE_CH39_FF35_IE10_WINDOWS.bat” helps you configure a node.

  • HERE: Current directory
  • JAVA_HOME: root folder of jdk
  • SELENIUM_VERSION: Change this value to whatever selenium version you would like to use. The helper has selenium-server-standalone-2.44.0.jar
  • PLATFORM: which platform do you want to run the node on .Valid values are {WINDOWS,VISTA,LINUX,MAC,ANY}
  • CHROME_VERSION: version of chrome browser
  • CHROME_DRIVER_VERSION: version of chromedriver.exe to be used with this node. You can find the versions inside “CHROMEDRIVERS” folder
  • CHROME_BINARY_LOC: Location of chrome browser binary
  • Same as above chrome variables, we have firefox and ie variables
  • HUB_HOST: hostname/ip of the host that this node will register to. Default value is localhost
  • NODE_HOST: hostname/ip of the machine on which this node is launched. Default value is localhost
  • NODE_PORT: port on which this node will be launched

Double click the script “START_NODE_CH39_FF35_IE10_WINDOWS.bat” on your windows machine.


GRID launched

At this point, the GRID should be launched and if you hit http://localhost:4444/grid/console, we should see the below


Add a new set of browsers

Let’s say you would like to enhance the grid and add a new set of browsers to the GRID. Let’s say you have installed chrome 37, firefox 30 and IE8 on a machine and you would like to add that machine as a node to this grid

Step 1

Download Selenium-grid-helper to the machine to any directory and navigate to the directory

Step 2

Make a copy of the file “START_NODE_CH39_FF35_IE10_WINDOWS.bat” inside the same directory and name the file accordingly. In our case we would like to name it “START_NODE_CH37_FF30_IE8_WINDOWS.bat”

Step 3

Make a copy of the file “START_NODE_CH39_FF35_IE10_WINDOWS.bat” inside the same directory and name the file accordingly. In our case we would like to name it “START_NODE_CH37_FF30_IE8_WINDOWS.bat”

Make the following changes to the variables inside the file

  • NODE_PORT=5559


Step 4

Double click the batch file and now your grid should look as below


Using a different version of webdriver

When we execute our scripts, we would always like to lockdown our versions of browsers and webdrivers. So if we know that a certain version of webdriver is what we used to automate the scripts , we would like to use the same version on the GRID node too right ?


Let’s take an example. This library by default uses chromedriver.exe with version 2.13. If you developed your scripts maybe couple of months ago and your scripts ran fine with 2.12, while debugging you would like to see if 2.13 has a bug or not. That means you would have to switch to 2.12 for testing purposes

Open the batch script that contains the browsers versions your node has and change the below line



That is it ! Now fire the script again and now the node should use 2.12 version of chromedriver.exe that is present in /CHROMEDRIVERS/2.12 folder

Using a version not supplied with this library

If you would like to use a version that is NOT supplied with this library, it is the same process again. Download the version let’s say 2.10 and create a folder in CHROMEDRIVERS and place the chromedriver.exe in that folder.

After that, change the value in batch script and double click it to start the node.

Using json config

All of the above scripts – We have set the configuration options inside a batch file. Selenium GRID lets us define the config options for the hub and grid in a json config file too. Some example config files for hub and node are as below. The files “hubConfig.json” and “nodeConfig.json” are present in the root folder.

Start HUB using json

Start Node using json


You could double click the batch files “START_HUB_USING_JSON.bat”


In this section we have seen how the scripts make our life much easier to start a GRID with various combinations of browsers. We can also manage the versions of the webdrivers, location of browser binaries and many more.

In the next section, we will see how this library aligns with our principles of consuming the GRID using a gem called “saucelabs