Select Page
Selenium Testing

The Selenium Grid Setup to Execute Tests on a Remote Machine

Save loads of time in test execution by learning the Selenium Grid Setup you need to run cross-platform testing on a Remote Machine.

The Selenium Grid Setup to Execute Tests on a Remote Machine - Blog
Listen to this blog

Selenium Grid is a concept that was introduced by the Selenium team to run Tests in remote machines by executing the tests across different Operating Systems, browsers, machines. As one of the best software QA companies, we always focus on ways to make our testing process more efficient. Selenium Grid is a great option to do just that as it helps to reduce the test execution time. So in this blog article, you will be learning about the Selenium Grid setup and tell you how you can use it.

Selenium Grid is an enhancement to the Selenium Web driver. The grid uses the Web driver’s code for executing the test scripts. The Grid contains a single Hub and one or more nodes.

We use Selenium Grid to run all the test scripts, present in the framework on a remote computer. In Selenium Grid, there are two types of systems, the first is HUB, and the other is a NODE.

Firstly, we will look into what a HUB is, and a few important points you should know.

  • It is a centralized place to which all the other nodes are connected.
  • There will be only one Hub.
  • Tests will be loaded and executed in the Hub.

Now, let’s take a few important points about NODE.

  • A node is a device that has been connected with the Hub. A node may be a Mobile, Tablet, Laptop, or Computer with different Operating Systems and browsers.
  • The number of nodes will vary depending upon the testing requirements.
  • Execution of tests will be displayed in the nodes.

Now that we have seen the basics, let’s explore the 3 main steps to use Selenium Grid, provided you have Selenium in your system. If you don’t, you can visit their official website to download the .jar file and place it in your desired drive before you proceed.

1) Start the Hub

2) Start the Node

3) Execute our Framework using remote WebDriver

1. Start the HUB

Open the command prompt on the exact location where you have kept the selenium-server jar file and type the following command:-

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

It should show the following message-

Nodes should register to
Clients should connect to

Selenium Grid hub is up and running

Selenium Grid Running

The default port number for the HUB is 4444.

2. Start the NODE

Since the hub is up and running now, copy the Selenium-server jar file and paste it into the desired drive of the remote computer where you want to run the test script. Once again open the command prompt on the exact location where you have that selenium-server jar file and type the following command.

java -jar ./selenium-server-standalone-3.141.59.jar -role node –hub

Note: Copy the hub URL from your HUB system.

Selenium Jar file command

It should show the following message-

Registering the node to the hub:

Now the node is registered to the hub and ready to use.

Registering Node into the hub

Also, you will get the following message on your HUB system.

Registered a node

Hub Register - Selenium Grid Setup

The default port no for a node is 25409.

3. Execute the Framework using the remote WebDriver

Now that both the main components of the Selenium Grid Setup are ready, it is time to execute the test scripts on a remote computer. We have to use the remote web driver class in order to specify which browser should be opened on the remote computer. We should use the desired capability class.

package Blog;
 import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.remote.DesiredCapabilities;
 import org.openqa.selenium.remote.RemoteWebDriver;
 import org.testng.annotations.*;
 public class Blog_Demo
     WebDriver driver;
     public void Beforemethod(@Optional("chrome") String browserName)
if(browserName.equalsIgnoreCase("firefox")) {
             driver= new RemoteWebDriver(DesiredCapabilities.firefox()); }
         else if(browserName.equalsIgnoreCase("chrome")) {
             driver= new RemoteWebDriver(; }
driver.get(""); }
     public void Sample1()
     public void Aftermethod()

For executing test scripts in the NODE system, simply execute the test script from the HUB system.

Once you run the script in the Hub System, you will get the following message in the hub system.

Hub System message - Selenium Grid Setup

You will get the following message in the node.

Selenium Node register - Selenium Grid setup

If at all you want to check whether the server is running or not, you can type the following command in the browser.



We hope you have found this Selenium Grid Setup blog of ours informative. Selenium Grid is a very resourceful tool that every tester has to know about. This is a very basic blog that introduces you to Selenium Grid. Explore our other blogs to learn more about it as it can be instrumental in reducing a lot of batch execution time. Its cross-platform capabilities have always come in handy to deliver the best agile test automation services.


Submit a Comment

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

Talk to our Experts

Amazing clients who
trust us