Let's assume that we have two machines: one will serve as the Grid Hub, and the second one will serve as a Selenium Node that will connect to the Grid Hub. One machine will have the IP 192.168.1.5, and the second one will have the IP 192.168.1.10.
Starting a Grid Hub on one (physical or virtual) machine and a Selenium Node on a different (physical or virtual) machine requires the following steps:
On the machine that will host the Grid Hub (192.168.1.5) these steps need to be followed:
- Open a Command Prompt window.
- Navigate to the directory where the selenium-server-standalone file is located.
- Write and run this command:
java -jar selenium-server-standalone-<version>.jar -role
hub
The default value of the Hub port is 4444, if not specified.
- You should receive a confirmation message, similar to the one we saw in Configuring and Connecting to a Local Grid.
On the machine that will host the Selenium Node (192.168.1.10) these steps need to be followed:
- Open a Command Prompt window.
- Navigate to the directory where the selenium-server-standalone file is located.
- Since we will only use the Chrome browser, write and run this command:
java -jar selenium-server-standalone-<version>.jar -role
node -hub http://192.168.1.5:4444/grid/register -browser
"browserName=chrome"
Note that the IP of the Grid Hub is used at the moment of registering the Selenium Node.
- Navigate to http://192.168.1.5:4444/grid/console to see the Grid Hub with the registered Selenium Node.
We are now able to understand how to configure and connect to a Network Selenium Grid.