Selenium grid Setup

Selenium grid setup in katalon studio

To leverage even more on parallel testing you can consider using a selenium grid setup for katalon studio. At the moment Katalon only support Selenium grid 3 but…

Running Selenium 3 tests on a Selenium 4 Grid is feasible and is designed to be backward compatible to ensure that tests written using the Selenium 3 API can still execute on the newer Selenium Grid version without requiring immediate code changes. However, to take full advantage of the new features and improvements in Selenium 4, it is recommended to eventually update your tests to Selenium 4. Here’s how you can run your Selenium 3 tests on a Selenium 4 Grid:

Setting up a Selenium Grid on Kubernetes or AWS Fargate provides a scalable and flexible infrastructure for parallel testing, allowing you to execute multiple Selenium tests across different browsers and operating systems simultaneously. This setup is beneficial for speeding up the execution of a large test suite and ensuring your application works correctly across different environments. Below are general guides for setting up Selenium Grid on Kubernetes and AWS Fargate.

Setting up Selenium Grid on Kubernetes

Kubernetes, an open-source platform for managing containerized workloads and services, is well-suited for running Selenium Grid in a scalable and resilient manner.

Prerequisites

  1. Create a Selenium Grid Deployment:
  1. Expose the Selenium Hub:
  1. Scale Selenium Nodes:
  1. Run Tests:

Setting up Selenium Grid on AWS Fargate

AWS Fargate is a serverless compute engine for containers that works with Amazon Elastic Container Service (ECS), allowing you to run containers without managing servers or clusters.

Prerequisites

  1. Create an ECS Cluster:
  1. Define Task Definitions:
  1. Run the Selenium Hub and Nodes as Services:
  1. Expose the Selenium Hub:
  1. Scale Selenium Nodes:
  1. Run Tests:

General Tips

If you want to try it out locally use a docker compose file from the selenium github to get it up and running

Docker Compose File for Selenium Grid

Create a docker-compose.yml file in your project directory and add the following content:

version: '3'
services:
 selenium-hub:
 image: selenium/hub:4.1.1-20211217
 container_name: selenium-hub
 ports:
 - "4444:4444"

 chrome-node:
 image: selenium/node-chrome:4.1.1-20211217
 container_name: chrome-node
 depends_on:
 - selenium-hub
 environment:
 - SE_EVENT_BUS_HOST=selenium-hub
 - SE_EVENT_BUS_PUBLISH_PORT=4442
 - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
 volumes:
 - /dev/shm:/dev/shm

 firefox-node:
 image: selenium/node-firefox:4.1.1-20211217
 container_name: firefox-node
 depends_on:
 - selenium-hub
 environment:
 - SE_EVENT_BUS_HOST=selenium-hub
 - SE_EVENT_BUS_PUBLISH_PORT=4442
 - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
 volumes:
 - /dev/shm:/dev/shm

Start Selenium Grid: Navigate to the directory containing your docker-compose.yml file. Run the following command to start all the services

docker-compose up -d
  1. Accessing the Selenium Grid Console: Once the containers are up and running, you can access the Selenium Grid console by navigating to http://localhost:4444 in your web browser. Here, you can see your Grid’s status and connected nodes.
  2. Running Tests: Now, you can run your Selenium tests against the Grid. Configure your test to use the remote WebDriver pointing to http://localhost:4444/wd/hub.
  3. Scaling Nodes: If you need more Chrome or Firefox nodes, you can scale them using Docker Compose. For example, to scale to 3 Chrome nodes, run:
  1. Stopping Selenium Grid: To stop and remove the containers, networks, and volumes created by docker-compose up, run:


docker-compose down

Customization