Selenium Grid 4 Standalone and Hub-Node

What Grid Does

Selenium Grid runs your tests on browsers on other machines. Tests send W3C WebDriver commands to one URL; the Grid routes each session to a node with the requested browser. Grid 4 is one jar with several roles.

TestNG threads (RemoteWebDriver)
        |  http://grid:4444
        v
+----------------- Selenium Grid 4 -----------------+
| Router -> Distributor -> Session Map, Event Bus   |
+---------------------------------------------------+
        |                    |                   |
   Node: Chrome x4     Node: Firefox x2     Node: Edge x2
   (Windows VM)        (Linux VM)           (Windows VM)

Standalone Mode

Example

Everything in one process, good for a laptop or a single CI agent:

java -jar selenium-server-4.25.0.jar standalone

Example output

INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
INFO [NodeOptions.getSessionFactories] - Detected 8 available processors
INFO [NodeOptions.report] - Adding Chrome for {"browserName": "chrome","platformName": "Windows 11"} 8 times
INFO [NodeOptions.report] - Adding Firefox for {"browserName": "firefox","platformName": "Windows 11"} 8 times
INFO [NodeOptions.report] - Adding Edge for {"browserName": "MicrosoftEdge","platformName": "Windows 11"} 8 times
INFO [Node.<init>] - Binding additional locator mechanisms: relative
INFO [GridModel.setAvailability] - Switching Node 4f1c2a9e (http://192.168.1.10:4444) from DOWN to UP
INFO [LocalDistributor.add] - Added node 4f1c2a9e at http://192.168.1.10:4444. Health check every 120s
INFO [Standalone.execute] - Started Selenium Standalone 4.25.0 (revision 8a8aea2337): http://192.168.1.10:4444

Tip: Open http://localhost:4444/ui to see the Grid console: nodes, free slots, running sessions and live VNC view (Docker images).

Hub and Nodes

Example

On the hub machine, then on each node machine:

# machine 1 (hub)
java -jar selenium-server-4.25.0.jar hub

# machine 2, 3... (nodes)
java -jar selenium-server-4.25.0.jar node --hub http://192.168.1.10:4444 --max-sessions 4

Example output

# hub log
INFO [Hub.execute] - Started Selenium Hub 4.25.0 (revision 8a8aea2337): http://192.168.1.10:4444
INFO [LocalDistributor.add] - Added node 9b7d03e1 at http://192.168.1.21:5555. Health check every 120s

# node log
INFO [NodeServer$1.start] - Starting registration process for Node http://192.168.1.21:5555
INFO [NodeServer.lambda$createHandlers$2] - Node has been added