</>

Technology

Selenium

Difficulty

Intermediate

Interview Question

What is a Hub in Selenium Grid?

Answer

A Hub is the central server (or central point) in Selenium Grid that:

  1. ✓Receives incoming test execution requests
  2. ✓Manages and tracks all registered nodes
  3. ✓Routes each test to an appropriate node based on requested capabilities
  4. ✓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:

HubNode
CountOne per gridMultiple
RoleRoutes requestsExecutes tests
Runs browserNoYes
Port44445555, 5556...

Follow AutomateQA

Related Topics