Selenium Grid Setup

Selenium is an automated test framework on the JavaScript framework. QAs prefer automated Selenium testing for recreating end-user actions on websites in order to track their behavior. It controls the interactions that occur on the specified web page and can operate them instantly without any need for manual effort. The Selenium suite is made up of four parts: 1. Selenium Grid 2. Selenium IDE 3. Selenium RC 4. Selenium Webdriver Now let's go through the selenium grid in a more detailed way.

Selenium Grid is indeed a smart proxy server which allows you to run tests on multiple machines in parallel. This is accomplished by routing commands to remote web browser instances, with one server serving as a hub. This hub sends JSON-formatted test commands to multiple registered Grid nodes.

Hub allows for the implementation of tests on multiple devices at the same time, centrally trying to manage multiple computers rather than running separate tests for each of them. Selenium Grid simplifies cross-browser testing by allowing a single test to be run on multiple machines and browsers at the same time, allowing for easy analysis and comparison of the results.

Become a master of Selenium by going through this HKR Selenium Training!

The Selenium Grid architecture is comprised of two major elements:

  • The Hub is a server that recognizes WebDriver client access requests and routes JSON test commands to remote drives on nodes. It receives instructions from the client and implements them at a remote location and in parallel on the multiple networks. 
  • Node is indeed a remote device that includes a native operating system and a remote WebDriver. It accepts data from the hub throughout the form of JSON test commands, which it then implements using WebDriver.

Selenium Grid architecture

Selenium Grid should be used by testers in the following situations:

  • To perform experiments on a variety of browsers and versions, as well as different devices and operating systems.
  • To shorten the time required for test data to finish execution. 

Related Article: Selenium vs Tosca

Selenium Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Selenium Grid shortens the time it takes for test results to be returned. It comes in handy especially when the test suite is large and takes a long time to run. It provides flexibility and expands test coverage in a short period of time. Maintenance is simplified now that the virtual infrastructure is in place.

If you want to Explore more about Selenium? then read our updated article - Selenium Tutorial

How to set up a selenium Grid?

Below are the steps for the selenium grid configuration.

Step1: Installation

Download the Selenium Server Standalone package before you begin. This package is a jar file that contains the Hub, WebDriver, and legacy RC required to run the Grid. To get started with Selenium Grid, you must first install Java and configure the environment variables.

Step2: Start Hub

The Selenium Grid's hub seems to be the central point that routes JSON test commands to the nodes. It expects to receive client test requests and routes them to the appropriate nodes. To install the Selenium Hub, launch the command prompt and navigate to the directory containing the Selenium Server Standalone jar file (downloaded in Step 1).

Type the following command

java -jar selenium-server-standalone-.jar -role hub

This will immediately begin the Hub on port 4444 by default. Testers can change the default port by specifying it as an optional parameter port.


while the command is being executed Unless someone is using an exotic network configuration or networking with VPN, testers do not need to specify the hostname because it can be determined automatically. In that case, specifying the host is required.

To check the status of the hub, launch a browser and go to https://localhost:4444/grid/console.

Step3: Start the nodes

Whether testers want to run a grid with new WebDriver functionality, Selenium 1 RC functionality, or both at the same time, they must use the same Selenium Server Standalone jar file to start the nodes. To start nodes, launch the command prompt and navigate to the directory containing the Selenium Server Standalone jar file.

Frequently asked Selenium Interview Questions and Answers !!

Subscribe to our youtube channel to get new updates..!

Type the following command

java -jar selenium-server-standalone-.jar -role node -hub https://localhost:4444/grid/register

When the -role option is not specified and the port is not the hub, the default port is 5555. As a result, it is critical to define the -role to be a node in this case.

Step4: Configure the nodes

When testers start the nodes, it allows 11 browsers to run concurrently, including 5 Firefox, 5 Chrome, and 1 Internet Explorer. It also allows testers to run up to 5 concurrent tests by default.

By configuring nodes, testers can change this and other browser settings. This is accomplished by passing parameters to each of the -browser switches that represent a node based on the parameters.

When the -browser parameter is specified, the default browser settings are ignored, and only the parameters specified in the command line are used.

Let us illustrate this with the installation of four Firefox version 4 nodes on a Windows machine.

-browser browserName=firefox,version=4,maxInstances=4,platform=WINDOWS

Map the location of each binary to the compatible version on the same machine if the machine has multiple versions of Firefox.

Consider the following scenario: there are two versions of Firefox, 3.6 and 4, on the same Windows machine that must be used at 5 and 4 instances, including both.

-browser browserName=firefox,version=3.6,firefox_binary=/home/myhomedir/firefox36/firefox,maxInstances=5,platform=WINDOWS -browser browserName=firefox,version=4,firefox_binary=/home/myhomedir/firefox4/firefox,maxInstances=4,platform=WINDOWS

As a result, testers can configure the nodes to meet their cross-browser testing needs, using the desired combination of browsers, versions, and operating systems.

Related Article: UFT vs Selenium

Step5: Selenium grid to run the tests.

After completing the Selenium Grid setup in the preceding four steps, testers can access the grid to run tests. When using Selenium 1 RC nodes, testers can use the DefaultSelenium object and pass it in the hub formation using the following command.

Selenium selenium = new DefaultSelenium(“localhost”, 4444, “*firefox”, “”);

If testers use Remote WebDriver nodes, they must define the browser, version, and platform and use the RemoteWebDriver and DesiredCapabilities objects. Create the following target browser capabilities to run the test on:

DesiredCapabilities capability = DesiredCapabilities.firefox();

Pass this set of browser capabilities into the RemoteWebDriver object once it has been created:

WebDriver driver = new RemoteWebDriver(new URL("https://localhost:4444/wd/hub"), capability);

Explore Selenium Sample Resumes Download & Edit, Get Noticed by Top Employers! 

Selenium Certification Training

Weekday / Weekend Batches


Selenium Grid allows you to run tests on multiple browsers, browser versions, and machines at the same time. After learning how to use Selenium Grid, testers can use parallel testing on BrowserStack's Cloud Selenium Grid to ensure cross-platform interoperability of their web apps.The Grid provides teams with instant access to over 2000 real browsers and devices of various versions, manufacturers, and operating systems. real desktop computers, iOS, and Android devices

Using Selenium Grid, it would aid in maintaining a good end-user experience that adheres to the agile development approach.

Find our upcoming Selenium Certification Training Online Classes

  • Batch starts on 3rd Jun 2023, Weekend batch

  • Batch starts on 7th Jun 2023, Weekday batch

  • Batch starts on 11th Jun 2023, Weekend batch

Global Promotional Image


Request for more information

Research Analyst
As a senior technical content writer for HRK tainings, srivalli patchava has a greater understanding of today's data-driven environment, which includes key aspects of data management and IT organizations. She manages the task of creating great content in the areas of software testing, DevOps, Robotic process automation. Connects with her on Linkedin and Twitter.