Selenium Grid With Docker Real Time
Selenium Grid With Docker Real Time
Dockerizing your
UI Tests
Jatin Shharma
SDET Master Class
Docker Grid
Create Selenium Grid (Using Docker Compose) and execute the test cases in
parallel with different browsers at single instance
Instance is running
sudo curl -L
"https://github.com/docker/compose/releases/download/1.26.0/docker-
compose-$(uname -s)-$(uname -m)" - o /usr/local/bin/docker-compose
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker- compose-
v3.yml down`
version: "3"
services:
chrome:
image: selenium/node-chrome:4.4.0-20220812
shm_size: 2gb
depends_on:
selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
edge:
image: selenium/node-edge:4.4.0-20220812
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
firefox:
image: selenium/node-firefox:4.4.0-20220812
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
selenium-hub:
image: selenium/hub:4.4.0-20220812
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
Step 8: After that we need to create file docker-compose.yml in order to run more
thanone containers in a one go.
Step 9 : Now we need to run our docker-compose file to setup the selenium hub and
nodes:
docker-compose up
Step 10: After that our selenium hub and nodes are ready and up and we can check
thatby accessing them with public ip of our amazon ec2 instance
After that we can run our selenium testcases on eclipse by providing url of our hub
All test cases are running on grid parallelly on different browser nodes.