Selenium Grid 4 Tutorial

On This Page What is Selenium Grid 4?How Selenium Grid 4 WorksJune 22, 2026 · 15 min read · Tool Comparison

Selenium Grid 4 Tutorial

Many testers assume escapeSelenium tests across browsersbecomes straightforward formerlyscript act locally. Set up the environs, trigger execution, and expectconsistent event across machine.

That expectation collapses the mo tests move beyonda individual apparatus. Scripts thatwalk locally start miscarry elsewhere, performance timing becomesirregular, and program differences introduce flakinessthat is hard todiagnose or reproduce.

Selenium Grid 4was introduced to address adeeper trouble than parallel execution. It rethinks how test sessions are created, route, and observedacross environments, turningdistributed essay from an operational riskinto a system that can beunderstood, controlled, and scaled with confidence.

Overview

What is Selenium Grid 4?

Selenium Grid 4 is a puppet that grant you to run Selenium tests across multiple browser and machines simultaneously. It amend test speed, ensures cross-browser compatibility, and provides better observability with its mod architecture.

When to Use Selenium Grid 4?

  • Large trial suites and fixation testing:Efficiently execute hundreds or thousands of tests for fixation or full-suite validation without bottlenecks.
  • Handling flaky or timing-sensitive tests:Reduce intermittent failures stimulate by environment differences, network latency, or asynchronous covering behavior.
  • Testing under imagination constraints:Scale testing without demand physical machine for each browser, using practical nodes or containers instead.
  • Performance and freight validation (UI-level):Run multiple UI examination in parallel to observe behavior under coincident sessions across browsers.

Setting Up Selenium Grid 4

  • Prerequisites:Make sure Java 11 or high is install and that the browsers and drivers you plan to use are available.
  • Download Selenium Server:Download the latest selenium-server- & lt; version & gt; .jar from the official Selenium website.
  • Start the Grid (Standalone Mode):Open a depot and run:
java -jar selenium-server- & lt; version & gt; .jar standalone

This launches a fully functional Grid at http: //localhost:4444, including both hub and node components.

  • Configure Nodes (Optional Multi-Machine Setup):For screen across multiple machines, start the hub firstly, then register additional nodes by pointing them to the hub ’ s IP address.
  • Run Tests:Update your WebDriver tests to join to the Grid at http: //localhost:4444 habituate RemoteWebDriver, limit the desired browser and platform capabilities.

In this clause, I will guide you through Selenium Grid 4, showing how to run tests efficiently across multiple browsers and platforms.

What is Selenium Grid 4?

Selenium Grid is a smart proxy waiter that makes it easygoing to run examination in parallel on multiple machine and manages different browser versions and browser configurations centrally (instead of singly, in case-by-case tests).

Ca n't Test Old Safari or Edge on Local Grid?

Installing legacy & amp; beta browsers locally is complex. Access cloud Grid with 3500+ browser/OS combinations.

Selenium Grid 4 is a fresh implementation and does not percentage the codebase of the premature version. Grid 4 takes advantage of new technologies in order to facilitate scaling up, while still allowing local execution.

Note:Before move further with this article, feature a look at this for a best understanding of its latest features conform.

How Selenium Grid 4 Works

Selenium Grid 4 executes tests by decouple tryout requests from browser performance, grant sessions to be route dynamically across available machines. Instead of stick test to a set frame-up, Grid 4 delicacy performance as a distributed system.

At a eminent level, this is how a test moves through the Grid during executing:

  • Session request submission: The WebDriver client sends a new session request to the Grid terminus with browser and platform capabilities.
  • Request routing: The Router incur the request and position it into the New Session Queue until matching resource are available.
  • Node selection: The Distributor evaluates register Nodes and selects one that can satisfy the requested capability.
  • Session registration: The selected session is recorded in the Session Map, creating a relentless mapping between the exam and the Node.
  • Command execution: All subsequent WebDriver commands are routed to the same Node, which execute them on the browser case.
  • State synchronization: The Event Bus propagates execution and availability updates across Grid component in real time.

Selenium Grid 4 Features

Selenium Grid 4 introduces a range of enhancements and architectural changes that make it more knock-down, scalable, and easier to manage than old adaptation.

Architecture Support

From Selenium 2, the Grid consisted of two processes – Hub and Nodes. architecture back four distinct process – Router, Session Map, Distributor, and Node.

Different Grid Types

Selenium 4 support three grid eccentric:

  • Standalone Mode
  • Authoritative Grid (Hub and Node)
  • Fully Distributed (Router, Distributor, Session, and Node)

Docker Support

Grid 4 fling Docker support. The Docker consolidation make not use Unix domain socket, so users need to make sure that the daemon is listening onport 2375.

When equate to Selenium Grid 3, this version is easy to use on.

Read More:

Improved Observability & amp; Debugging

  • Built-in logging, case trace, and elaborated session tracking.
  • Integration with external monitoring tools is easier via APIs and telemetry support.

Selenium Grid UI

  • New web-based interface for real-time monitoring and direction of Grid status, session, and nodes.
  • Helps quick identify test dispersion and system health.

Better Configuration Management

  • Uses TOML-based conformation files that are more readable and easier to maintain.
  • Supports CLI and environment-based configuration overrides.

Cloud and Kubernetes Integration

  • Designed for modern cloud-native deployments.
  • Easily deployable on Kubernetes and compatible with major cloud program.

These characteristic conjointly create Selenium Grid 4 a comprehensive, flexible, and modern solution for automated at scale.

To explore the Selenium Grid 4 features in detail, refer to

Selenium Grid 4 is powerful, but grapple infrastructure can be complex. offers a cloud-based choice. It provides instant access to real devices and browser, supports Selenium tests, and scales effortlessly for parallel execution. For squad seeking faster, hassle-free testing, BrowserStack is an first-class answer.

Components of Selenium Grid 4 Architecture

Selenium Grid 4 introduces a modular and distributed architecture that enhances flexibility, execution, and scalability. Each component in the architecture plays a specific purpose in negociate and executing automated tests.

Router

The Router is the primal entry point for all international requests to the Grid. It receives both session creation and bid execution requests, directing new session requests to the Distributor and routing ongoing session commands to the correct Node based on session information.

Its main function is to manage and streamline communication across different element.

Distributor

The Distributor manages test session allocation. When the Router receives a new session request, it forwards it to the Distributor, which evaluates the available Nodes and selects the most suitable one based on the desired potentiality and current load.

This decision-making process ensures efficient use of system resources and balanced examination execution.

Session Map

The Session Map maintains a register of all active sessions in the Grid. It links each session ID to the Node care it. When a test command is issued, the Router refer the Session Map to determine which Node should receive the request.

This part is critical for ensuring that bid are sent to the correct browser case.

Node

A Node in Selenium Grid 4 is the existent execution environment where browser instances are launched and tryout are run. Each Node registers itself with the Distributor, publicise its capabilities such as supported browsers, version, and platforms.

The Selenium Grid 4 Node Configuration is crucial in defining these capacity. This configuration is typically managed using a TOML file or command-line parameters, making it flexible and easy to tailor-make for different environments. Once a session is assigned, the Node executes the test and communicates results through the Grid base.

New Session Queue

The New Session Queue handles incoming session petition in a sequential and controlled fashion. It insure that the Grid make not get overloaded by trammel how many session requests are processed at a clip.

This component is particularly useful in high-demand scenarios, allowing the Grid to care capacity and payload more efficaciously.

Event Bus

The Event Bus enables seamless communication among distributed components using a publish-subscribe model. It countenance different constituent of the Grid to stay updated on events such as Node status change, session starts, or result.

This interior messaging scheme ensures that the components operate in sync and react promptly to system events.

Selenium Grid 4 Deployment Modes in 2026

Selenium Grid 4 can be deployed in multiple way calculate on team need, infrastructure, and scale. Each mode changes how the ingredient interact and how test session are managed.

Here are the different deployment modes in Selenium Grid 4:

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

1. Standalone Mode

Standalone mode combines all Grid component, including Router, Distributor, Session Map, Event Bus, and Nodes, into a single process. All communication happens in memory, which cut net latency.

Test asking go to the local Router, the Distributor immediately happen a matching Node, and session are managed in the like procedure. This mode is ideal for small-scale testing, debugging, or local maturation.

How to deploy:

  • Download the latest selenium-server- & lt; version & gt; .jar.
  • Run the Grid in standalone mode using:
java -jar selenium-server- & lt; version & gt; .jar standalone
  • Nodes can be included in the like process or connected outwardly.
  • Access the Grid console at http: //localhost:4444 to see fighting sessions and nodes.

2. Hub and Node Mode

In hub and node way, the Router, Distributor, and Session Map run in a fundamental hub process. Nodes run on freestanding machines and register to the hub over HTTP or WebSocket.

When a test request arrive, the Router forwards it to the Distributor, which question registered Nodes for matching capabilities. The Event Bus propagates session state changes between the hub and nodes, ensuring tryout execution is synchronized and stable.

How to deploy:

  • Start the hub using:
java -jar selenium-server- & lt; version & gt; .jar hub
  • On each Node machine, file the Node with the hub using:
java -jar selenium-server- & lt; edition & gt; .jar node -- hub http: // & lt; hub-ip & gt; :4444
  • Confirm nodes are connected by ascertain the hub console.

3. Fully Distributed Mode

In amply distributed way, each Grid component, include Router, Distributor, Session Map, and Event Bus, runs on a freestanding machine. Nodes register to the Distributor or Router as configured.

Test requests go to the Router, which transmit with the Distributor to find a compatible Node. The Event Bus propagates update across all components in existent time, enabling fault tolerance and dynamic cargo balancing for large-scale parallel examination.

How to deploy:

  • Start each component on separate machines using their various commands:
java -jar selenium-server- & lt; adaptation & gt; .jar router java -jar selenium-server- & lt; edition & gt; .jar distributor java -jar selenium-server- & lt; version & gt; .jar sessionmap java -jar selenium-server- & lt; version & gt; .jar eventbus
  • Start Nodes and register them with the appropriate Distributor or Router.
  • Monitor factor via their respective console or logarithm.

4. Docker and Kubernetes Deployments

This modality runs Grid components inside containers with fugacious Nodes that can scale dynamically. Routers and Distributors intercommunicate over container networking, and the Event Bus synchronizes session state.

Nodes can mechanically register and deregister based on demand, allowing easy grading and integration with CI/CD pipeline.

How to deploy:

  • Use Selenium Grid Docker icon:
docker run -d -p 4444:4444 selenium/standalone-chrome
  • For distributed setups, run freestanding containers for router, distributer, and nodes, connect them via a Docker network.
  • Kubernetes manifest can be used to deploy the Grid, automatically scaling Nodes based on test demand.

Ca n't Test Old Safari or Edge on Local Grid?

Installing bequest & amp; beta browsers locally is complex. Access cloud Grid with 3500+ browser/OS combinations.

Advantages of Grid 4

Selenium Grid 4 offer several sweetening over its predecessors, make test execution more efficient, scalable, and suitable for modern testing needs.

  • Provides a wide range of programming words support.
  • Offers dedicated framework support.
  • Supports multiple browsers and multiple operating systems just like.
  • It is free and open-source.
  • It endorse (Local and Cloud-Based).
  • It has a powerful reporting tool for test progress trailing.
  • It integrates with.

Also Read:

Installing and Configuring Selenium Grid 4 in 2026

The initiatory step is understanding how to download Selenium Grid 4. The latest adaptation of Selenium 4 (Alpha) is4.0.0-alpha-7and the like can be downloaded from the official Selenium site.

Let & # 8217; s understand Selenium Grid 4 & # 8217; s functioning by apply Selenium Grid version4.0.0-alpha, as it is more stable than the other versions.

Selenium Grid 4 can be set up in the following modes:

  • Standalone
  • Hub and Node
  • Distributed
  • Docker

1. Standalone

The new Selenium Server Jar contains all the functionality postulate to run a grid. By default, the host will be listening onhttp: //localhost:4444port & # 8211; the URL to point RemoteWebDriver tests. The server will detect usable driver that it can use from the System PATH.

java -jar selenium-server-4.0.0-alpha-7.jar standalone

2. Hub and Node

Start the hub using the below command:

java -jar selenium-server-4.0.0-alpha-7.jar hub

Node enrollment can be done using the command below:

java -jar selenium-server-4.0.0-alpha-7.jar node -- detect-drivers true

3. Distributed

Users can begin Grid 4 in a fully distributed manner, with each conceptual part in its own process. First, begin the session map creditworthy for map session IDs to the node the session is scat on.

java -jar selenium-server-4.0.0-alpha-1.jar session

Then the Distributor:

java -jar selenium-server-4.0.0-alpha-1.jar distributor -- sessions http: //localhost:5556

The Distributoris aware of all the Nodes and their capabilities. Its main role is to receive a new session request and find a suitable Node where the session can be created. After the session is created, the Distributor stores in the Session Map, the relative between the session id and Node where the session is being executed.

Now start the system with a router to expose it to the Web:

java -jar selenium-server-4.0.0-alpha-1.jar router -- sessions http: //localhost:5556 -- distributor http: //localhost:5553

This router will be listening to new session requests on

http: //localhost:4444

Now, this is all set up, use this dictation:

curl http: //localhost:4444/status

and it should get confirmed.

4. Using Docker

The docker integration doesn & # 8217; t do use of UNIX domain socket. So first, ensure the docker daemon is listening on port 2375 using the command below on the console:

socat -ls TCP-LISTEN:2375, reuseaddr, fork UNIX-CONNECT: /var/run/docker.sock

Note:If docker daemon is not listening to port 2375, so postdate the below steps:

1. Create daemon.json file in /etc/docker

{`` hosts '': [`` tcp: //0.0.0.0:2375 '', `` unix: ///var/run/docker.sock '']}

2. Add

/etc/systemd/system/docker.service.d/override.conf [Service] ExecStart= ExecStart=/usr/bin/dockerd

3. Reload the systemd daemon:

systemctl daemon-reload

4. Restart docker:

systemctl restart docker.service

Once that ’ s done, it & # 8217; s easy to start the and have it delegate to docker for make new instances:

java -jar selenium-server-4.0.0-alpha-1.jar standalone -D selenium/standalone-firefox: latest ' {`` browserName '': `` firefox ''} ' -- detect-drivers mistaken

Or just start a node:

java -jar selenium-server-4.0.0-alpha-1.jar node -D selenium/standalone-firefox: latest ' {`` browserName '': `` firefox ''} '

The next steps from hither remain the same with setting up the Grid. You can relate to the for the future steps.

Limitations of Selenium Grid 4

Selenium Grid 4 significantly amend parallel executing and scalability, but it is not without constraint. Understanding these limitations facilitate teams plan infrastructure and decide when a cloud-based result might be more effective.

  • Complex setup for large-scale deployments: Fully dispense mode requires multiple machine and careful network configuration.
  • Maintenance overhead: Nodes can become unresponsive or misconfigured, requiring manual monitoring and troubleshooting.
  • Circumscribed observability compared to cloud grids: While the Event Bus supply home updates, deep analytics, logging, and failure diagnostics are minimal.
  • Scaling constraints on local infrastructure: Running many nodes locally can exhaust CPU, memory, and browser bound.
  • Browser and platform dependency direction: Teams must manually install and maintain drivers and browser versions.

What & # 8217; s the deviation & # 8211; Grid 3 vs Grid 4

get up with only Hub node setup. To set up a grid on Selenium 3, the alone option is the Hub-node setup. All machines should experience aselenium-standalone jardownloaded as a hub to represent as a hub in the cluster and a node to correspond as a node with freestanding commands.

Whereas, Selenium Grid 4can be set up using the above-mentioned methods as it is diversified and comes up with additional features. The entire grid apparatus has been written from scratch with all modern puppet and model to support fully distributed testing and comes with extensive Docker support.

And that is how users can get commence with Selenium Grid 4, in order to leverage its many vantage.

How BrowserStack Enhances Selenium Grid 4 Testing

BrowserStack is acloud-based testing platformthat furnish access to hundreds of real browser and device without the need to manage infrastructure. It desegregate seamlessly with Selenium Grid 4, allowing teams to accomplish tests at scale while reducing setup, alimony, and environment-related failures.

By unite Selenium Grid 4 with BrowserStack, team gainreliable parallel execution, improved observability, and admission to existent device, which transforms distributed prove from a local constriction into a scalable, efficient workflow.

Key BrowserStack features for Selenium Grid 4 testing:

  • : Run Selenium test on actual device sooner than emulator, assure outcome reverberate true end-user behavior.
  • : Execute 100 of tests concurrently across multiple browsers and devices, fully leverage Grid 4 ’ s parallel execution capabilities.
  • : Test apps host behind firewalls or on local servers by connecting Grid 4 session to BrowserStack ’ s untroubled burrow.
  • : Capture logs, screenshots, and videos for every tryout, cater deep insights for debug flaky or failing session.
  • : Seamlessly relate Selenium Grid 4 exam scripts with BrowserStack SDKs for advanced automation workflows and CI/CD pipelines.

Ca n't Test Old Safari or Edge on Local Grid?

Installing legacy & amp; beta browsers locally is complex. Access cloud Grid with 3500+ browser/OS combinations.

What Experts Recommend for Selenium Grid 4

Selenium Grid 4 introduces aboriginal observability features that disclose how sessions move through the Grid. Here are some recommendation from expert with hands-on experience using Selenium Grid 4.

  1. Dave Haeffner, author of Elemental Selenium, has advised that tester should reserve Selenium Grid run for cross-browser and parallel establishment, while keeping local execution as the primary loop for test development and debugging.
  2. Simon Stewart,Divine of Selenium, has stated that Selenium Grid 4 should be operated like a distributed system, which mean tester must monitor session routing, node availability, and Grid health rather than treating execution as opaque
  3. Boni García, Selenium contributor and creator of WebDriverManager, has stated that Selenium Grid 4 user should bank on the Grid ’ s aboriginal browser and driver management alternatively of maintaining custom driver setup per node.
  4. Bas Dijkstra, test mechanisation consultant and Selenium community contributor, has stated that Selenium Grid 4 should be enclose only after examination are stable, because Grid parallelism magnifies timing issues and synchronization problems.

Conclusion

Selenium Grid 4 modernizes distributed test executing with a robust architecture that divide routing, session direction, and node execution. It enable parallel testing at scale, improves fault tolerance, and provides clear observability, helping teams run examination reliably across multiple browser and platforms.

BrowserStack removes base constraints and provides approach to existent devices, parallel execution, and secure local testing. Combined with detailed reporting and SDK support, it allows squad to scale automation, debug faster, and render software more reliably.

Tags
39,000+ Views

# Ask-and-Contributeabout this topic with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free