57
Debug Selenium Tests in Docker using VNC Viewer
In the previous post, we learned how to integrate Selenium tests with Docker. In this tutorial, we will take a look at how to integrate VNC Viewer with Docker and debug Selenium tests in Docker using VNC Viewer. We will also learn why it's important to run tests through VNC Viewer as well.
Originally, when I was preparing this post, I was going to name the title "View Selenium Tests in Docker using VNC Viewer". Because I thought the goal is to be able to view the tests running in VNC.
However, the main reason we want to view tests in VNC viewer is to be able to debug any test issues that are happening inside the Docker. Typically, when tests are being triggered inside Docker container, you are not able to see anything that's happening inside. But, with the help of the VNC viewer, you get a visual representation of exactly what's going on inside Docker which makes it easier to debug your test issues.
-debug
will have a VNC server installedLet's run the selenium/standalone-chrome-debug image and map the VNC port with it -
docker run -d -p 4444:4444 -p 5900:5900 --shm-size=2g selenium/standalone-chrome-debug:3.141.59-20210607
Now that we have a docker image running mapped to port 5900, we can open that port in VNC viewer. To do that, open up the RealVNC client and type in the URL -
127.0.0.1:5900
, and hit Enter. When prompted for a password, type
VNC server pointed to port 5900
secret
and continue. VNC server pointed to port 5900

Now it's time to run tests in Docker, make sure your tests are pointed to port 4444 as that is what we have set up for our docker container (you can check out my previous post to learn more about that).
Once you will run your tests, you will notice the tests can be viewable in the VNC viewer. 🙌🏼

📧 Subscribe to my mailing list to get access to more content like this as well as free access to a Private Facebook community
👍 You can follow my content here as well -
...
I love coffees! And, if this post helped you out and you would like to support my work, you can do that by clicking on the button below and buying me a cup of coffee -

You can also support me by liking and sharing this content.
Thanks for reading!
57