Introduction
Remote execution is one of the most powerful features of Selenium automation. Instead of running tests only on your local machine, Selenium allows you to execute tests on remote machines that contain different browsers and operating systems. This is achieved using Hub & Node Architecture, which is the traditional architecture of Selenium Grid.
In this architecture, the Hub acts as a central controller that receives all Selenium test requests, while the Nodes are remote machines that host browsers and execute the tests. This setup enables cross-browser testing, cross-platform testing, and parallel execution, making it ideal for large automation projects.
Although Selenium Grid 4 introduced a more advanced distributed architecture, the Hub & Node concept is still widely used in interviews, legacy projects, and when explaining how remote execution works.
In this tutorial, you’ll learn what Hub & Node Architecture is, how it works, its components, advantages, and best practices.
What is Hub & Node Architecture?
Hub & Node Architecture is the traditional architecture of Selenium Grid where a central Hub manages one or more Nodes.
The
Hubreceives Selenium test requests.The
Nodehosts browsers and executes the Selenium tests.The Hub decides which Node should execute the requested test.
The execution result is sent back to the Selenium client.
This architecture allows Selenium tests to run remotely instead of only on the local machine.
Why Use Hub & Node Architecture?
Hub & Node Architecture offers several advantages:
Supports remote execution.
Enables parallel test execution.
Allows cross-browser testing.
Supports multiple operating systems.
Reduces test execution time.
Improves resource utilization.
Simplifies centralized test management.
Scales automation across multiple machines.
Components of Hub & Node Architecture
Hub
The Hub is the central server in Selenium Grid.
Its responsibilities include:
Receiving test execution requests.
Managing connected Nodes.
Selecting the appropriate Node.
Creating browser sessions.
Returning execution results.
Generally, a Grid contains one Hub that manages multiple Nodes.
Node
A Node is a machine connected to the Hub.
Each Node contains one or more browsers, such as:
Chrome
Firefox
Edge
Safari
When the Hub assigns a test to a Node, the Node launches the required browser, executes the Selenium commands, and returns the results.
A Grid can contain multiple Nodes to increase execution capacity.
How Hub & Node Architecture Works
The execution flow is as follows:
A Selenium test sends a request to the Hub.
The Hub receives the request.
The Hub checks all registered Nodes.
It finds a Node with the required browser and operating system.
The Hub forwards the request to that Node.
The Node launches the browser and executes the test.
The execution result is sent back to the Hub.
The Hub returns the response to the Selenium test.
This entire process happens automatically.
Hub & Node Architecture Diagram
Selenium Test
│
▼
Hub
(Receives Requests)
│
┌──────────┼──────────┐
▼ ▼ ▼
Node 1 Node 2 Node 3
│ │ │
Chrome Firefox Edge
The Hub acts as the central controller, while the Nodes execute the tests using the installed browsers.
Hub vs Node
| Feature | Hub | Node |
|---|---|---|
| Role | Central controller | Executes Selenium tests |
| Receives Test Requests | Yes | No |
| Hosts Browsers | No | Yes |
| Executes Tests | No | Yes |
| Manages Browser Sessions | Yes | No |
| Number in a Grid | Usually one | One or more |
Hub & Node Architecture in Selenium Grid 4
Although Selenium Grid 4 introduces components such as the Router, Distributor, and Session Queue, the Hub & Node concept is still commonly used when discussing remote execution.
| Selenium Grid 3 | Selenium Grid 4 |
|---|---|
| Hub | Router + Distributor |
| Nodes | Nodes |
| Basic Session Management | Advanced Session Management |
| No Built-in Dashboard | Built-in Grid UI |
Understanding Hub & Node Architecture provides a solid foundation for learning the newer Selenium Grid 4 architecture.
Practical Example
Suppose an e-commerce company needs to test its website on Chrome, Firefox, and Edge.
Instead of maintaining three separate test machines, the company sets up one Hub and three Nodes. Each Node contains a different browser. The Hub automatically sends each test to the appropriate Node, allowing all browsers to execute tests simultaneously.
Automation Testing Example
Consider an online banking application.
The regression suite contains hundreds of Selenium test cases. A Jenkins pipeline triggers the automation suite after every deployment. The Hub receives all execution requests and distributes them across multiple Nodes running Chrome, Firefox, and Edge. This parallel execution significantly reduces testing time and ensures compatibility across different browsers.
Real-World Example
Hub & Node Architecture is widely used in:
Selenium Grid environments
Enterprise automation frameworks
Jenkins CI/CD pipelines
GitHub Actions
Azure DevOps
Banking applications
Healthcare systems
E-commerce platforms
Insurance applications
Cross-browser testing projects
Advantages of Hub & Node Architecture
Enables remote execution.
Supports parallel testing.
Reduces overall execution time.
Allows cross-browser testing.
Supports multiple operating systems.
Improves scalability.
Centralizes browser management.
Efficiently utilizes testing resources.
Common Mistakes Beginners Make
Confusing the Hub and Node
Many beginners think the Hub executes the test.
In reality, the Hub only manages requests, while the Node executes the Selenium test.
Not Registering Nodes
A Hub without connected Nodes cannot execute any tests.
Always ensure that Nodes are properly registered before running automation scripts.
Assuming Every Node Supports Every Browser
A Node can only execute tests for browsers that are installed and configured on that machine.
Ignoring Browser Compatibility
Ensure that the browser version, driver version, and Selenium version are compatible across all Nodes.
Best Practices
Use multiple Nodes for parallel execution.
Register Nodes before executing tests.
Keep browser versions updated.
Monitor Node availability regularly.
Balance test execution across Nodes.
Integrate Selenium Grid with CI/CD pipelines.
Use Selenium Grid 4 for new automation projects while understanding the Hub & Node concept for legacy systems.
Conclusion
Hub & Node Architecture is the traditional execution model used by Selenium Grid for remote browser automation. The Hub receives Selenium test requests and intelligently distributes them to connected Nodes, where the actual browser execution takes place. This architecture enables parallel execution, cross-browser testing, and distributed automation, making it an essential concept for Selenium automation engineers. Even though Selenium Grid 4 introduces a newer architecture, understanding Hub & Node Architecture remains valuable for interviews, maintaining legacy frameworks, and building a strong foundation in remote execution.
Frequently Asked Questions (FAQs)
What is Hub & Node Architecture?
Hub & Node Architecture is the traditional Selenium Grid architecture where a central Hub manages multiple Nodes that execute Selenium tests.
What is the role of the Hub?
The Hub receives Selenium test requests, manages connected Nodes, assigns browser sessions, and returns execution results.
What is the role of a Node?
A Node hosts one or more browsers and executes Selenium tests assigned by the Hub.
Can multiple Nodes connect to a single Hub?
Yes.
A single Hub can manage multiple Nodes, enabling parallel execution across different browsers and operating systems.
Is Hub & Node Architecture still relevant?
Yes.
Although Selenium Grid 4 uses a more advanced architecture internally, the Hub & Node concept is still important for understanding remote execution, maintaining legacy Selenium Grid setups, and preparing for Selenium interviews.
Key Takeaways
Hubis the central controller of Selenium Grid.Nodeshost browsers and execute Selenium tests.Hub & Node Architecture enables remote and parallel execution.
Multiple Nodes can connect to a single Hub.
Understanding Hub & Node Architecture provides the foundation for learning Selenium Grid and remote execution.
