Selenium WebDriver – How To Set Up Dockerized Selenium Grid in AWS / Cloud

Overview:

We already have seen setting up JMeter Distributed Infrastructure using RancherOS.  We will see how to manage dockerized selenium grid using RancherOS. Rancher helps us to set up the grid in the local machine / AWS / any cloud.

I would suggest you to read the above article on setting up the Rancher UI and adding AWS hosts etc.

Rancher – Stack:

Stack is a set of services to be run for the application. For the ‘Selenium Grid’ Stack, Lets assume we need below services.

  • 1 selenium-hub container
  • at least 1 chrome container – connected to the above selenium-hub container
  • at least 1 firefox container – connected to the above selenium-hub container

Setting Up Selenium Grid:

  • Go to Rancher UI – Stack screen to add a new Stack.

grid-stack-1

  • I am going to call the stack as selenium-grid as shown here. [You could also upload your stack YAML config instead of setting up everything manually.]

grid-stack-2

  • Once it is created, lets define the set of services we need. Click on the Add Service.

grid-stack-3

  • I need the selenium-hub container first. I need to map the port 4444 of the container to the host port 4444.

grid-hub-1

  • I am going to create a chrome container as shown here. It needs to be linked with selenium-hub container we had created. Repeat this step for firefox container as well.

grid-hub-chrome

  • Now our grid-stack will look like this.

grid-hub-all

  • Now click on the chrome/firefox to monitor, scale them up/down etc

grid-scale

  • Rancher gives us an option to export the config in the YAML file for backup of our infrastructure.

stack-export-yml

  • I could access the dockerized selenium grid in the cloud using http://[ip of hub]:4444/grid/console

grid-console

 

 

Happy Testing & Subscribe 🙂

 

Share This:

Categories: AWS / Cloud, CI / CD / DevOps, Docker, Selenium, Selenium Grid