What is the exact purpose of Selenium Grid?

You are pretty correct in your conclusion that the purpose of Selenium Grid is to execute the tests remotely on remote machines. The two main reasons to distribute your tests are:

  • Reduce execution time of your Test Suite.
  • To avoid memory (e.g. RAM) crunch on your localhost and you can find a couple of relevant discussions in:
    • Limit chrome headless CPU and memory usage
    • Many process of Google Chrome (32 bit)
    • Selenium using too much RAM with Firefox
    • Is it possible to reduce memory RAM consumption when using Selenium GeckoDriver and Firefox

Remote WebDriver

As per the official documentation of Remote WebDriver:

You can use WebDriver remotely the same way you would use it locally. The primary difference is that a remote WebDriver needs to be configured so that it can run your tests on a separate machine.

A remote WebDriver is composed of two parts: the server and the client. The client is the WebDriver test and the server is simply a Java servlet, which can be hosted in any modern JEE app server.

Remote WebDriver server

The Remote WebDriver server will always run on the machine with the browser you want to test. The server can be initiated either from the command line (or through code configuration).

Remote WebDriver client

To run a Remote WebDriver client you have to first connect to the RemoteWebDriver. We do this by pointing the URL to the address of the server running our tests.

Steps in details

You need to follow the below mentioned steps:

  • Start the Selenium Grid Hub:

    java -jar selenium-server-standalone-3.141.59.jar -role hub
  • Logs generated:

    18:10:13.310 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
    18:10:13.618 INFO [GridLauncherV3.lambda$buildLaunchers$5] - Launching Selenium Grid hub on port 4444
    2020-01-02 18:10:14.605:INFO::main: Logging initialized @2136ms to org.seleniumhq.jetty9.util.log.StdErrLog
    18:10:15.504 INFO [Hub.start] - Selenium Grid hub is up and running
    18:10:15.509 INFO [Hub.start] - Nodes should register to
    18:10:15.510 INFO [Hub.start] - Clients should connect to
  • Access the Selenium Grid Console v.3.141.59 through the url http://localhost:4444/grid/console:


  • Start the Selenium Grid Node:

    java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.141.59.jar -role node -port 7777 -hub
  • Logs generated:

    18:33:55.959 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
    18:33:56.112 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Launching a Selenium Grid node on port 7777
    2020-01-02 18:33:56.584:INFO::main: Logging initialized @983ms to org.seleniumhq.jetty9.util.log.StdErrLog
    18:33:56.913 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
    18:33:57.029 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 7777
    18:33:57.029 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
    18:33:57.195 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
    18:33:57.734 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub:
    18:33:57.856 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use
  • Access the Selenium Grid Console v.3.141.59 again through the url http://localhost:4444/grid/console to view the registered node:


Leave a Comment