How to setup Selenium Grid in Docker | Using Docker Compose yml file | Part 1

Published: 25 February 2021
on channel: Maximum Automation
4,335
48

In this video we are going to see that, how to setup selenium grid on docker.

We can setup the grid on docker with easy commands using docker-compose method.

To start with, first install the docker in your system based on your operating system.

After that download the docker-compose.yml file. Below is the sample docker compose file content.

###################################################
To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
Add the `-d` flag at the end for detached execution
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
volumes:
/dev/shm:/dev/shm
depends_on:
selenium-hub
environment:
HUB_PORT_4444_TCP_ADDR=selenium-hub
HUB_PORT_4444_TCP_PORT=4444
NODE_MAX_INSTANCES=5

ports:
"6900:5900"


firefox:
image: selenium/node-firefox
volumes:
/dev/shm:/dev/shm
depends_on:
selenium-hub
environment:
HUB_PORT_4444_TCP_ADDR=selenium-hub
HUB_PORT_4444_TCP_PORT=4444
NODE_MAX_INSTANCES=3

ports:
"6902:5900"

selenium-hub:
image: selenium/hub
container_name: selenium-hub
ports:
"4444:4444"

####################################################

To setup the grid, open the command prompt and make sure that you are at the same directory where your docker-compose file is placed.
Run the below command in sequence

docker pull selenium/hub

docker pull selenium/node-chrome

docker pull selenium/node-firefox

Above commands will download the images from docker server.
Now run the below command to setup the grid.

docker-compose up -d

Now, if you go to the browser and type the url localhost:4444

Then you will see that selenium grid is running on the provided port and two nodes are attached with it, one for browser chrome and the other one for firefox.

In case you want to stop the selenium grid setup then you can do that by typing the below command.

docker-compose down

So this is how we can setup the selenium grid in docker.


**********Please comment in case of any query.**************

Also, please see other videos as well.

How to setup selenium grid in docker Part1 :    • How to setup Selenium Grid in Docker ...  

How to setup selenium grid in docker-Part2    • How to setup Selenium Grid in Docker ...  

Selenium with C# - Klov Report :    • Selenium with C# | Klov Report Server  

Selenium with C# - Extent Report :    • Selenium with C# | Extent Report  

Selenium with C# - Create Project to automate test (Selenium + Specflow ) :    • Video  

Selenium with C# - Parallel Execution and Screenshot :    • Video  

Selenium with C# - All about feature files :    • Video  

Serilog - Logging in Automation Framework :    • Serilog | Logging in Automation Frame...  

Selenium with C# - Specflow - External Bindings :    • Selenium C# | Specflow | External Bin...  

Selenium - Working with Excel - Part 1 :    • Video  

Selenium with Java - Cucumber Html Report :    • Selenium with Java | Cucumber Html Re...  

Object Repository | YAML file | Selenium JAVA | BDD Framework -    • Object Repository | How to maintain O...  


Watch video How to setup Selenium Grid in Docker | Using Docker Compose yml file | Part 1 online without registration, duration hours minute second in high quality. This video was added by user Maximum Automation 25 February 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,335 once and liked it 48 people.