A Hub is the central server (or central point) in Selenium Grid that:
- ✓Receives incoming test execution requests
- ✓Manages and tracks all registered nodes
- ✓Routes each test to an appropriate node based on requested capabilities
- ✓Monitors the overall execution status
Key characteristics:
- ✓There is only ONE Hub per Selenium Grid setup
- ✓Acts as the entry point — test scripts connect to the hub
- ✓Does NOT execute tests itself — delegates to nodes
- ✓Runs on port 4444 by default
Starting the Hub (Selenium 4):
Bash
java -jar selenium-server-4.x.jar hub
Hub URL:
CODE
http://hub-machine-ip:4444
Connecting a test to the Hub:
Java
RemoteWebDriver driver = new RemoteWebDriver(
new URL("http://hub-machine-ip:4444"),
new ChromeOptions()
);
Hub vs Node:
| Hub | Node | |
|---|---|---|
| Count | One per grid | Multiple |
| Role | Routes requests | Executes tests |
| Runs browser | No | Yes |
| Port | 4444 | 5555, 5556... |
