Back to cheat sheet hub

Selenium Grid Cheat Sheet

A quick reference for distributed Selenium execution across browsers and environments using Grid and Docker.

Selenium Module 9 Grid + Docker Remote execution

What Grid Solves

Grid helps run tests remotely and across multiple browser environments.

Good for:
- cross-browser runs
- scaling execution
- centralized infra
- CI usage

Core Architecture

Modern Grid routes sessions to available browser nodes.

Hub / distributor / session queue / nodes

RemoteWebDriver

Use RemoteWebDriver to send commands to a remote Grid endpoint.

WebDriver driver = new RemoteWebDriver(
    new URL("http://localhost:4444"),
    new ChromeOptions()
);

Capabilities and Options

Declare the browser you need and any required options cleanly.

ChromeOptions options = new ChromeOptions();
options.addArguments("--headless=new");

Docker Grid

Docker makes Grid setup repeatable and much easier to scale.

Typical pieces:
- selenium/hub
- browser nodes
- docker-compose

Scaling

Scale only when the suite is isolated and stable enough to benefit.

Focus on:
- thread safety
- test independence
- environment readiness

CI Integration

Grid is especially useful when the CI environment needs many browser sessions.

Pipeline flow:
checkout -> start grid -> run tests -> collect reports

Good Use Cases

Grid makes sense when local single-machine runs no longer match team needs.

- regression suite scaling
- browser coverage
- shared QA infra
- remote execution labs