TABLE OF CONTENTS
2. Executing Selenium Scripts on Windows
2.1 Setting the Browser Type in the Application Settings File
2.2 Adding the Docker files into the algoQA Script Generated Folder
3.3 Managing Docker Compose Services and Resources
1. Overview of Selenium Grid
Selenium Grid is a tool used for distributing Selenium WebDriver tests across multiple machines (nodes) in a network. It allows you to execute tests in parallel on different browsers, operating systems, and versions, all managed centrally by a hub. Using Selenium Grid involves setting up a distributed testing environment for Selenium WebDriver tests.
2. Executing Selenium Scripts on Windows
Make sure to install Java and Maven to run Selenium scripts. If not, refer to Configuring web applications using Java Selenium framework.
To install Docker Desktop for windows installer, click here (optional step).
2.1 Setting the Type and the Hub URL in the Application Settings File
Perform the following:
After generating the script, download it to your local folder. This folder must contain the script file that you have generated.
- Open the folder where you downloaded the script. For example, if your script is located at AlgoAFScript_202402121131\src\test\java, navigate to this folder. Applications.xml file will be available in the Java folder as shown:
- Open the Application Settings file and locate the setting related to the 'Type' and Hub URL . Set Type setting to 'Selenium GRID' and Update the Hub URL with the IP address of your system or the IP address of the environment that you are running followed by colon and the port number, as shown:
2.2 Adding the Docker files into the algoQA Script Generated Folder
Perform the following:
Download the attached Docker compose YAML file, which sets up a Selenium Grid environment with a Selenium Hub (selenium-hub) and a Chrome node (chrome). The Selenium Hub manages the distribution of Selenium tests across multiple nodes (chrome in this case). The Chrome node is configured to connect to the Selenium Hub using environment variables and to expose its VNC port for visualization.
Note: The VNC port is a networking protocol that enables you to visualize and interact with Chrome browser instances running in the Docker containers. Exposing the VNC port allows direct observation and interaction with the browser during test execution. By default, VNC servers start at port 5900 and increase sequentially for each additional display. For example, a VNC server assigned to display number 1 operates on port 5901, display number 2 on port 5902, and so forth. This sequential pattern ensures each VNC session is uniquely identified by its corresponding port number.
Navigate to the Downloads folder > open the Docker compose file and save the Docker file into same folder where your script is generated, as shown:
2.3 Executing Scripts
Perform the following:
- To start all the services defined in a Docker Compose configuration file, run the following command in the command prompt:
docker-compose up
- Run the following command to execute the scripts in the command prompt:
mvn test
- Run the following command to to stop and remove containers, networks, and volumes created by docker-compose up:
docker-compose down - This command is used to clean up resources after running a Docker Compose application, ensuring that all containers and associated resources are properly shut down and removed.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article