So far you've been running tests on your laptop. One browser at a time. Chrome, maybe Firefox if you're feeling adventurous. That's fine for development. But imagine running 500 tests on 3 browsers — that's 1,500 test executions. On your laptop. One at a time. You'd be waiting all day.
Selenium Grid solves this. It lets you run tests on multiple machines and browsers simultaneously. Think of it like a restaurant kitchen: instead of one chef cooking all dishes, you have multiple chefs (nodes) working in parallel, coordinated by a head chef (hub).
Your test code talks to the Hub. The Hub looks at what browser you need and routes the request to an available Node that has that browser. Nodes run the actual browsers. You can have 10 Chrome nodes, 5 Firefox nodes — as many as your infrastructure supports.
| Component | What It Does |
|---|---|
| Router | Entry point — receives all incoming test requests |
| Distributor | Decides which Node should handle each request |
| Session Map | Tracks which session is running on which Node |
| Node | Runs the actual browser and executes commands |
| Event Bus | Internal messaging between components |
Don't worry about memorizing all components. For practical use, you need to know two things: the Hub receives requests, and Nodes run browsers. That's it.
To run tests on Grid, you replace your local ChromeDriver with RemoteWebDriver. Instead of talking to a local browser, RemoteWebDriver talks to the Grid Hub over HTTP. The Hub finds a node with the browser you need and runs your test there.
// LOCAL — runs Chrome on your machine
WebDriver driver = new ChromeDriver();
// GRID — runs Chrome on a Grid Node
ChromeOptions options = new ChromeOptions();
WebDriver driver = new RemoteWebDriver(
new URL("http://localhost:4444"), // Grid Hub URL
options
);Key Point: Your test code stays the same. Only the driver creation changes — ChromeDriver becomes RemoteWebDriver. That's the beauty of Selenium Grid. Tests don't care where the browser is running.
# Download the Selenium Server JAR from
# https://www.selenium.dev/downloads/
# Start Grid in Standalone mode (Hub + Node on one machine)
java -jar selenium-server-4.18.1.jar standalone
# Grid is now running at http://localhost:4444
# Dashboard at http://localhost:4444/ui
# --- Distributed mode (separate Hub + Nodes) ---
# Terminal 1: Start the Hub
java -jar selenium-server-4.18.1.jar hub
# Terminal 2: Start a Node (auto-detects installed browsers)
java -jar selenium-server-4.18.1.jar node --detect-drivers true
# Terminal 3: Node on a different machine
java -jar selenium-server-4.18.1.jar node \
--hub http://hub-machine-ip:4444 \
--detect-drivers trueThe Grid dashboard at http://localhost:4444/ui is your best friend. It shows all registered nodes, available browsers, active sessions, and queue. Bookmark it.
Q: What is Selenium Grid and what problem does it solve?
A: Selenium Grid is a tool that distributes test execution across multiple machines and browsers. It has a Hub-Node architecture — the Hub receives test requests and routes them to available Nodes that run the actual browsers. It solves two problems: speed (run tests in parallel across multiple browsers) and coverage (test on browsers you don't have installed locally). In our CI pipeline, we use Docker-based Selenium Grid with Chrome, Firefox, and Edge nodes running in parallel, which cuts our execution time by 3x.
Key Point: Selenium Grid = Hub routes requests, Nodes run browsers. Your test code stays the same — only driver creation changes to RemoteWebDriver.