In Docker, all software parts can be organized in containers.
Why Test With Selenium & Docker Together?ĭocker is a software containerization platform that provides virtualization from the operating system level.
This blog post will provide an overview of how to run Selenium tests in Docker. Looking forward to create a professional Test Automation project with the implementation of CI using Test Automation.By running Selenium tests through Docker containers, you can save time when creating your tests and get more testing options. I know this is very simple however there are still a lot of issues to be solved to successfully run this. Note: This is just a sample project to verify the running of tests on Docker containers. Parallelly open the view of the VNC Viewer for the port mentioned above Exact Command: docker run -d -p 4444:4444 -p 5900:5900 -shm-size=2g selenium/standalone-chrome-debug:3.141.59-20210929Ħ) Change the call for the WebDriver (In this case ChromeDriver) to RemoteWebDriver in the project. Command Template: docker run -d -p :4444 -p :5900 -shm-size=2g selenium/standalone-chrome-debug: Command Template: docker run -d -p :4444 -shm-size=2g selenium/standalone-chrome: Right side is the Java/Selenium code which is on my local machine which triggers the tests to open the browser and verify the page title.īelow are the settings and details of the Sample TestNG project created to verify this: Project link: Steps:ġ) Download and Install Docker latest version (based on your OS)Ģ) Download and Install VNC viewer (RealVNC)ģ) Open Command Prompt / Terminal and Check the docker version installed (docker version)Ĥ) Open the VNC Viewer and enter the link as "localhost:5900" and open the viewĥ) Download and Run the container for the Selenium Chrome, below are commands Containerization will be coming soon in all software development and operation aspects and soon will be looked upon for testing the applications either dockerizing the existing Test Automation projects or creating a new one.Ībove left side image is of running the Web tests on Chrome within the Docker container viewed by VNC Viewer. What a powerful feasibility provided by Docker.