Sun. Feb 23rd, 2025
  1. Install Java: Selenium requires Java to be installed on your system. Make sure you have the latest version of Java installed.
  2. Download Selenium: Download version 4.8.0 of Selenium from the official website.
  3. Start the Hub: Open the command line and navigate to the directory where you have extracted Selenium. Run the following command to start the hub:
java -jar selenium-server-standalone-4.8.0.jar -role hub
  1. Start a Node: In another terminal window, navigate to the same directory and run the following command to start a node:
java -jar selenium-server-standalone-4.8.0.jar -role node -hub http://<hub-ip>:4444/grid/register
  1. Verify Grid Setup: To verify that the grid is up and running, open a web browser and navigate to http://<hub-ip>:4444/grid/console. You should see the hub and node status on the console.
  2. Run Tests: Finally, you can run your Selenium tests by connecting to the grid. In your test code, set the desired capabilities to connect to the grid and specify the hub URL.

Example in Java:

codeDesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setBrowserName("chrome"); WebDriver driver = new RemoteWebDriver(newURL("http://<hub-ip>:4444/wd/hub"), capabilities); driver.get("http://www.google.com");

This is a simple example of how to set up Selenium Grid 4.8.0 and run tests in parallel on multiple machines. You can extend this setup to include multiple nodes with different browsers and configurations to run tests in parallel on multiple platforms.

Related Post