venkat2789 / selenium-grid-dockerized

An approach to run selenium UI tests on a dockerized selenium grid with a hub and nodes for different browsers e.g. chrome, firefox etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

selenium-grid-dockerized

An approach to run selenium UI tests on a dockerized selenium grid with a hub and nodes for different browsers e.g. chrome, firefox etc.

Uses images: hub, node-firefox, node-chrome

Pre-requisites:

  • Docker
  • Docker Desktop (not mandatory, but recommended to start stop the daemon engine)
  • Start the docker engine

Refer: Docker Docs

Steps to run:

All configurations to hub and nodes are in docker-compose.yaml file, add/modify nodes based on needs. To spin up containers, run docker-compose up

To run in detached mode, run docker-compose up -d

Go to MainTest to run the sample tests. Add more tests, edit browser configs in DriverSetup. Following dependencies are already included:

  • Selenium 4
  • TestNG 7

After execution:

docker-compose down

Other useful docker commands:

docker container ps - list running containers

docker container ps -a - list running and stopped containers

docker container logs <name or id of container> - when running in detached mode, to see container logs

docker exec -ti <name or id of container> /bin/bash - shell into running container to run commands on container's terminal. -t - allocates pseudo tty (unix terminology) -i - keeps std in open

About

An approach to run selenium UI tests on a dockerized selenium grid with a hub and nodes for different browsers e.g. chrome, firefox etc.


Languages

Language:HTML 66.8%Language:CSS 19.4%Language:JavaScript 11.0%Language:Java 2.8%