Site icon TestingDocs.com

Selenium Hub and Nodes

Introduction

In this post, we will discuss the hub and nodes configuration with Selenium grid ( Get Started with Selenium Grid). Also, we will see sample command line commands to start the hub and register nodes. Furthermore, I have used the Windows 10 operating system and Selenium server 2.53.1 version and localhost.

First of all, to set up Selenium grid we need Selenium Server. We can download the server jar file from selenium official website here:  http://www.seleniumhq.org/download/

Tip: Always download the latest version, the latest version would have bug fixes and enhancements.

 

Selenium Hub

To start the hub, open the command prompt and navigate to the location where you have a jar file. We can start it by using the following command.

/>  java -jar selenium-server-standalone-<<version>>.jar -role hub

After you have run the above command, it will start. Also, you should see a success message that it has started successfully. Also, it runs at a default port 4444. Furthermore, you can check the status in the browser by typing the URL:

http://localhost:4444/grid/console.

Selenium Nodes

Now, we will register a node. To do that,  open another new command prompt window and navigate to the location where you have jar file. Type the below command to register a node.

/> java -jar selenium-server-standalone-<<version>>.jar -role node -hub http://localhost:4444/grid/register

As a result, to check the node status, visit http://localhost:4444/grid/console in the browser.

 

In addition, we can also customize the browsers and the no of instances we need for testing. For example, If we want to launch 2 Firefox and 2 internet explorer instances for testing.

Below is the command to customize the instances.

/> java -jar selenium-server-standalone-2.53.1.jar -role node -hub http://localhost:4444/grid/register -port 5555 -browser browserName=firefox,maxInstances=2 -browser browserName=iexplorer,maxInstances=2

 

 

Since we have customized, we can notice in the above figure that 2 firefox browser instances and 2 internet explorer instances are registered with the node. Also, notice that we can choose the port number for the node. In addition, if we want to start browser instances at the port 5557 we can specify that in the above command.

Run a test

https://www.testingdocs.com/running-test-using-remotewebdriver-with-marionette/

Selenium WebDriver Tutorials on this website can be found at:

https://www.testingdocs.com/selenium-webdriver-tutorial

For more details on the Selenium, visit the official website at:

https://www.selenium.dev/

Exit mobile version