

Run Selenium Standalone Chrome Docker image locally For example, I can have Chrome v91 running on port 4444 as well as Chrome v81 running on port 4446 and can execute the tests on both.ĭocker provides you with a lot more flexibility in terms of choosing the different browsers as well as choosing the browser versions without having to worry about any kind of infrastructure setup. Multiple version supportĪnother advantage that we get with Docker is that we can have multiple Chrome versions set up which we can use to execute our tests. Despite what version you have in your local machine, you can still go ahead and execute your tests within Docker. So to solve this problem we can use Docker images that come with a specific ChromeDriver as well as the browser installed which is compatible with each other. This becomes quite a common problem every time there’s a mismatch of versions. if I need to run tests in the older version then I need to downgrade my Chrome browser to v89.if I need to run tests in the latest version then I need to update the ChromeDriver to v91.In my case, my browser version was v91 and the ChromeDriver version was v89. This error comes when the version of the ChromeDriver and the version of the local browser don’t match. If you have been running your tests without Docker, you might have seen this kind of error before - session not created: This version of ChromeDriver only supports Chrome version 89 Why should we run Selenium tests in Docker?īefore we run our tests in Docker, it’s important to understand the problems Docker can solve for us.

You can also use the sample script I created in JavaScript . Basic Selenium script: you will also need a sample script that you can execute to run your tests.Docker installed: you also should have docker installed in your local machine .Basic familiarity with Docker: you should at least have a high-level understanding of Docker concepts.There are few prerequisites that you need to be aware of before we get started. We will also understand why we should run Selenium tests in Docker? Prerequisite In this tutorial, we will cover how to run Selenium tests in Docker and execute them in Chrome and Firefox browsers.
