On student A's laptop/machine:
- 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.
- Get student A's laptop/machine IP (will be needed for the next steps).
On student's B laptop/machine:
- Open a Command Prompt window.
- Navigate to the directory where the selenium-server-standalone file is located.
- We'll only use the Chrome browser, write and run this command:
java -jar selenium-server-standalone-<version>.jar -role
node -hub http://studentA_machine_IP:4444/grid/register -browser "browserName=chrome"
Replace studentA_machine_IP for the actual IP of the laptop/machine that student A is using, which is the one where the Grid Hub is running.
- Navigate to http://studentA_machine_IP:4444/grid/console to see the Grid Hub with the registered Selenium Node.
We have created a small Selenium Grid. Now let's run our AgeCalculatorTest against it:
-
Switch the remote Grid Hub url from localhost to the IP of student A's laptop/ machine:
driver = new RemoteWebDriver(new URL("http://studentA_ machine_IP:4444/wd/hub"), desiredCapabilities);
- Compile and run the test. We should be able to see on Student A's console how the test request is received, and how Google Chrome opens on Students B's laptop/machine.