This his project demonstrates parallel test execution using Selenium Grid by leveraging Java multithreading and RemoteWebDriver. It enables cross-browser testing across Chrome, Firefox, and Edge to improve automation efficiency and execution speed.
Demonstration_Selenium_Grid
This project demonstrates Parallel Testing using Selenium Grid by executing multiple browser sessions simultaneously using Java Threads and RemoteWebDriver.
The goal of this project is to showcase how Selenium Grid can be used to improve test execution speed and efficiently run tests across different browsers in parallel.
π Key Features
Parallel execution using Java Multithreading
Cross-browser testing using Selenium Grid
Supports Chrome, Firefox, and Microsoft Edge
Uses RemoteWebDriver to connect with Selenium Grid Hub
Automatic screenshot capture
Clean browser session management
π οΈ Tech Stack
Java
Selenium WebDriver
Selenium Grid
RemoteWebDriver
Multithreading (Java Threads)
π Project Structure Demonstration_Selenium_Grid β βββ src β βββ test β βββ java β βββ com.ibm.parallelgrid β βββ ParallelGridTest.java β βββ screenshotutil β βββ pictureutility.java β βββ README.md
βοΈ Prerequisites
Make sure you have the following installed:
Java (JDK 8 or above)
Selenium Server (Grid)
Chrome, Firefox, Edge browsers
Corresponding browser drivers
Maven / IDE (IntelliJ or Eclipse)
π§© Selenium Grid Setup 1οΈβ£ Start Selenium Grid Hub java -jar selenium-server-4.x.x.jar hub
2οΈβ£ Start Node (Example) java -jar selenium-server-4.x.x.jar node --hub http://localhost:4444
Ensure that your node supports the required browsers.
Each test case runs in a separate thread
Each thread initializes its own RemoteWebDriver
Browsers execute simultaneously on Selenium Grid
After execution, each browser session is closed independently
π§ͺ Test Data Used String[][] testData = { {"https://www.flipkart.com/", "chrome"}, {"https://www.amazon.in/", "firefox"}, {"https://www.croma.com/", "MicrosoftEdge"} };
Each URL is opened in a different browser in parallel.
πΌοΈ Screenshot Capture
Screenshots are captured using a custom utility:
pictureutility.takePic(driver, "./src/test/resources/");
This helps in debugging and test validation.
π How to Run the Test
Start Selenium Grid Hub and Node
Open the project in your IDE
Run the ParallelGridTest.java file
Observe multiple browsers opening simultaneously
π Sample Output [chrome] Opened: https://www.flipkart.com/ [firefox] Opened: https://www.amazon.in/ [MicrosoftEdge] Opened: https://www.croma.com/ All tests completed!