What Is Selenium Grid?
Selenium Grid lets you run tests on many machines and browsers at once. Your test talks to the Grid, the Grid picks a free browser on some machine, and runs the commands there.
| Reason | Benefit |
|---|---|
| Speed | Run 8 tests at the same time |
| Cross-browser | Chrome, Firefox and Edge from one suite |
| Cross-platform | Windows, Linux and macOS nodes |
| Clean machines | Tests do not use your laptop |
Grid 4 Modes
| Mode | Use |
|---|---|
| Standalone | One machine runs everything. Easiest. Good for local use and learning |
| Hub and Node | A hub plus several nodes on different machines |
| Distributed | Router, Distributor, Session Map, Event Bus as separate parts for very large setups |
Requirements
- Java 17 or newer (the Grid server is a Java program)
- Download
selenium-server-<version>.jarfrom selenium.dev downloads - Browsers installed on the machine (Selenium Manager can help with drivers)
Standalone Grid
Open http://localhost:4444 to see the Grid UI with available browsers and sessions.
Hub and Node
Use the Grid from Python
Change the options class to switch browsers:
Choose Platform and Version
Plug into the Framework
Our driver factory from the framework lesson already supports --remote:
Useful Grid Settings
| Setting | Meaning |
|---|---|
--max-sessions N (node) | Number of browsers this node can run at the same time |
--session-timeout 300 | Kill sessions that are idle for 300 seconds. Prevents stuck sessions |
--override-max-sessions true | Allow more sessions than CPU cores (use with care) |
Troubleshooting
| Problem | Fix |
|---|---|
SessionNotCreatedException | No node supports that browser/version; check the Grid UI |
| Tests wait in a queue | All slots busy: add nodes or lower the number of workers |
| Nodes not visible on hub | Firewall or wrong hub address; open port 4444 (and 5555/4442/4443 for event bus in some setups) |
| Sessions never ends | Always call driver.quit(), set a session timeout |
Conclusion
The Grid receives sessions from tests and starts browsers on available nodes. Use webdriver.Remote with the Grid URL, call quit() always and combine it with pytest-xdist for fast parallel runs.

