Selenium was born in 2004. With its open source nature and comprehensive features, it has long ranked Top1 in the field of Web test automation tools, and is currently the most mainstream Web test automation tool. Moreover, Selenium’s core Webdriver serves as the prevailing W3C standard and is widely referenced by various tools. It can be said to be the de facto standard for web test automation today.
Changes Brought by Selenium 4
After years of evolution, Selenium itself has now been released up to version V4.24. Although usages and materials related to the V3 version are still widely circulated online, Selenium 4 is actually a very major update. Several of its core components have undergone extensive refactoring.
- WebDriver switched from the original Json Wire Protocol to the W3C standard definition
- Selenium IDE completed its refactoring and feature optimization
- Selenium Grid completed its refactoring and supports a more flexible cloud service architecture
In addition, Selenium 4 introduced a very important tool, which is the Selenium Manager we are going to focus on in this article (it was actually introduced only in V4.6, and its features were basically complete only by V4.12
Problems Caused by the Original Browser Driver Approach
To understand Selenium Manager, we still need to first understand how Selenium works.
How Selenium Works
The figure below is the basic architecture of Selenium’s local execution given on the official site.

As can be seen, Selenium actually accomplishes automation by driving different types of browsers (Chrome, Firefox, IE, Edge, Safari, etc.) through the webdriver protocol to complete specified actions, thereby achieving the goal of automated execution.
The key to driving a browser is the browser Driver that corresponds to the browser, such as ChromeDriver for Chrome, GecoDriver for FireFox, and so on.
And Selenium itself interacts with the browser Driver based on the WebDriver protocol.
The Problems It Causes
Although this architecture and working principle are clear, there is one problem: browser versions are constantly being updated. And the browser driver version needs to match the browser version; when mismatched driver and browser versions work together, various unexpected exceptions may occur. Therefore, for Selenium to work properly, before writing code with the Selenium library, the first thing is to ensure the deployment and matching of the browser driver and browser versions.
But browser versions and their corresponding drivers are usually maintained by the browser vendors.
So preparing the test automation environment here becomes rather complicated: you need to install the browser of the corresponding version under test, and at the same time find the driver corresponding to that version, then configure the relevant paths for Selenium, and only then can Selenium complete normal driving.
In addition, browser versions generally also have an auto-update feature. It may happen that, without the user noticing, the version has already changed, but at that time the driver version is not updated synchronously, so this also leads to the potential problem of driver and browser version mismatch.
This problem was actually not well resolved for a long time. With Selenium 3 and the early versions of Selenium 4, when we deployed a Selenium automation environment, obtaining and matching browser versions and driver versions was always a rather troublesome task, and because of this it discouraged quite a few test automation beginners.
Chrome’s Response to the Driver Problem
Since this problem has existed for a long time, browser vendors have also actually realized the troubles that a mismatch between driver and browser versions brings to test automation.
Taking Chrome as an example, if we go to the official ChromeDriver downloads page, we will see a page like this

As can be seen, Chrome Driver downloads here are only provided up to version 114, while the latest Chrome has actually already reached version 128. For versions after 115, the Chrome browser actually adjusted the driver release strategy, that is, Chrome driver is released in sync with the Chrome for Testing version, strictly ensuring the synchronous matching of driver and browser versions.
So why is there a Chrome for Testing version here?
As we mentioned earlier, browser versions have auto-update; if an auto-update happens, the driver version is not updated synchronously, thus causing a mismatch between driver and browser.
So the main difference between Chrome for Testing and the official version is actually that the for Testing version does not perform auto-updates.
In this way, together with the sharing of version numbers with the browser version, it is very convenient to ensure consistency between the browser and the driver.
Selenium’s Solution to the Driver Matching Problem
The above is the solution given by browsers to the driver matching problem, but it still does not completely solve the problem that the browser and Driver need to be obtained and specified separately. So Selenium’s official solution to this problem is Selenium Manager. It is actually an executable program included in the Selenium library, requiring no additional installation.

If we currently use Selenium V4 to execute a simple test automation script:
For example, to search for the Chinese phrase 城下秋草 测试 on Baidu, the code is as follows:
| |
As long as the Selenium library is installed, when executing, it can drive normally, without any special need to obtain the driver and configuration.

Source Code Analysis of Selenium 4 Launching Automation Execution
Here we analyze its startup process from Selenium’s Python source code:
driver = webdriver.Chrome(options=option)
This line of code actually calls the webdriver initialization code for the Chromium-based browser in the Selenium library, located at .venv/Lib/site-packages/selenium/webdriver/chromium/webdriver.py
During initialization, as can be seen, the DriverFinder method is used to obtain the paths of the browser and the Driver
| |
And the method for obtaining the paths actually calls the binary_paths method of the SeleniumManager module
| |
The SeleniumManager module, in turn, executes the SeleniumManager binary program and, based on the relevant parameters, obtains the browser and driver versions.
| |
Therefore, when the current Selenium 4 version executes, it uses the SeleniumManager program to determine the required browser and corresponding driver version.
The Selenium Manager Command-Line Program
Through SeleniumManager, based on the browser type and version we configure, it can automatically match the relevant driver version, and connect to the network on its own to obtain the files of the relevant driver and browser version for Selenium to call.
For example, in the case above, we specified the browser version as 117; after execution, the downloaded browser and corresponding driver version are actually saved in the .cache\selenium directory under the user directory. The figure below shows the driver of version 117 currently updated by the execution.

What Selenium calls here is the Selenium-manager command-line program
We can directly execute this program and add --help to see the supported parameters
| |
We can execute it to take a look at the output information here; actually, when selenium executes, it is precisely this command-line program that it calls
| |
And besides Browser and Driver, Selenium-manager actually also supports downloading grid versions. Through the --grid parameter, the latest version of grid can be downloaded directly.
| |
From the introduction above, it can be seen that by introducing Selenium-manager, Selenium can now, during environment preparation, very flexibly achieve automatic acquisition and configuration of resources such as the browser, the driver, and even the grid server, greatly improving the convenience of using Selenium.
