Selenium Grid Set Up and Run Test in Grid Environment!

Selenium Grid is a proxy server that allows running test cases in parallel across different machines, browsers, and operating systems. It implements a hub-node architecture where one hub controls multiple node machines.

🧞‍♂️Importance of Selenium Grid:

✔️Parallel execution reduces test execution time

✔️Cross-browser/cross-platform testing from a single control point

✔️Resource optimization by distributing test load

✔️Reduced infrastructure costs by utilizing existing machines

✔️Better test coverage across different environments

🧞‍♂️Grid can be setup in two different mode:

  1. Standalone: is a single-node Grid where all of the Grid components are running on the same machine. This is the easiest way to get started with Selenium Grid but also the least scalable and flexible.
Standalone (single machine) Setup 
  • Download selenium-server-<version_number>.jar and place it one a directory 
  • Run the below command to start Selenium Grid in standalone mode
    • javajar seleniumserver-<version>.jar standalone 
  • Keep running the standalone server and get the grid url 
  • Check out the Status of Grid session: http//localhost:4444/
  •  Or: http://192.168.2.50:4444

2. Distributed : One hub will connect with multiple node machines using the same network and execute the test cases in nodes following OS and browser request, this setup is known as Distributed Grid setup. This setup provides a scalable, maintainable way to run distributed tests across different environments. Ex: Docker-based Setup. 

  • Event Bus: It facilitates communication among various components within the Grid components. The default ports of Event Bus are 4442, 4443, and 5557.
  • Session Map: It links Session IDs to the specific Node where the session is active. The default port no. is 5556.
  • Distributor: This step involves identifying the suitable node for test execution. The default port no. is 5553.
  • Router: It actively monitors incoming new session requests. The default port no. is 4444. 

Distributed setup and example can be done easily through docker or browserStack is a cloud base services offers mv setup to run multiple or parallel test with grid environment.

Distributed (multi node)Setup

**

🚀Learn Grid implementation in 𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 with end-to-end real time project through my Udemy course: 👉 https://shorturl.at/l7U3x
Share the Knowledge

You May Also Like

About the Author: Sariful I.

Leave a Reply

Your email address will not be published. Required fields are marked *