Tutorial at the integration of the selenium grid with docker?


Presentation Description

Learn how to integrate the selenium grid with docker with the benefits of using Docker with selenium grid and see all over execution time of the tests.


Presentation Transcript

How to Integrate Selenium Grid with Docker?:

How to Integrate Selenium Grid with Docker ?

Introduction Selenium Grid with Docker:

Introduction Selenium Grid with D ocker Selenium grid helps to master hub to disturbed test cases among the slave machine. A hub is a machine on which best tests are executed, but they run on different nodes. Docker is an also container which is using store libraries and dependencies. So if you want your selenium grid server to be up to running at that time representation will enable you to understand the process quick & easily too.

Prerequisites for Docker Setup in your machine:

Prerequisites for Docker Setup in your machine

Slide 4:

Visit the official website: https://www.docker.com/products/docker-toolbox and download Docker toolbox. For successful installation, click on all the checkboxes and you will get follow the procedure. After successful installation, you will notice below icons on your desktop.

Slide 5:

Download Docker   Images Selenium hub image Selenium node -Firefox image Selenium node-chrome image Selenium node - F irefox -debug image Selenium node-chrome-debug image Download images by search from https://hub.docker.com/ here you will get a list of images so click on them which have maximum numbers of pulls.

Slide 6:

When you click on the image, you will see a Docker Command. It is a command to install images to Docker container. Copy this command and paste into Docker container one by one. You can write next command after the previous image download. Image Command Selenium hub docker pull selenium/hub Selenium firefox node docker pull selenium/node- firefox Selenium chrome node docker pull selenium/node-chrome Selenium firefox debug docker pull selenium/node- firefox -debug Selenium chrome debug docker pull selenium/node-chrome-debug

Slide 7:

First step is to start selenium hub, so write below command in Docker container. docker run -d -p 4444:4444 –name selenium-hub selenium/hub Start Selenium Hub Selenium Hub will be opened by this command, now check that it is started or not using below URL: http:// Your.IP.Address /grid/console Note: Here Replace Your.IP.Address with real your IP Address.

Slide 8:

Let's start Chrome node and Firefox node one by one. You can run nodes as you require. Here I have used two nodes only. Run browsers by below commands: Start Selenium Node docker run -d –link selenium-hub:hub selenium/node-firefox docker run -d –link selenium-hub:hub selenium/node-chrome After that run the Chrome debug node and Firefox debug node by following commands:

Slide 9:

Now, we have to find the port numbers on which node – Chrome and Firefox is running. We can simply find out by firing below command in the Quickstart terminal. docker ps -a Soon, we know the port numbers of chrome and firefox debug nodes that are running so we can start both the browsers working VNC viewer. docker run -d –P –link selenium- hub:hub selenium/node- firefox -debug docker run -d –P –link selenium- hub:hub selenium/node-chrome-debug

Slide 10:

Start browsers using VNC viewer

Slide 11:

Also, here we have to set parallel flag in a testng.xml file by writing parallel=” tests” tag in suite name. By running this test, we will see that it is executing on both the browsers. Let’s see a sample test script:

Slide 12:

So here we learn how to integrate Selenium with Docker step by step. When we have a huge number of test cases, you can apply a selenium grid for making test case executions fast. Using selenium grid, we can test our test cases under different Browser and Different Operating system. References: https://datafloq.com/read/how-integrate-selenium-grid-with-docker/6264 https://www.softwaretestinghelp.com/docker-selenium-tutorial/

Slide 13:

Royal Square, 1st Floor, Off No. 110, Nr. Shilp Tower, Tagore Road, Rajkot – 360001 Gujarat, India. www.nexsoftsys.com hs@nexsoftsys.com

authorStream Live Help