Using Selenium Manager to Automate Browser Driver Setup
Learn how Selenium Manager in Selenium 4.6+ automatically downloads and caches the correct browser driver, reducing setup overhead and improving test reliability.
02 Sept 2025, 13:10 UTC

Problem: Driver mismatches stall test runs
When you launch a Selenium test without a matching driver binary, you see errors like “session not created: This version of ChromeDriver only supports Chrome version X”. The fix used to involve downloading the correct driver, setting its path, or relying on third‑party managers such as WebDriverManager.
Thesis: Selenium Manager removes the manual step
Starting with Selenium 4.6, the built‑in Selenium Manager automatically detects the installed browser version, downloads the matching driver binary, caches it, and hands it to the WebDriver—all without extra configuration.
How Selenium Manager works
- At runtime it queries the browser executable for its version number.
- It resolves the appropriate driver version from the official download servers.
- If a matching driver already exists on the
PATHor in the~/.seleniummanager/cachedirectory, it reuses it. - Otherwise it downloads the driver to the cache and returns its path to the WebDriver.
Enabling, disabling, and configuring
The feature is on by default for the Java, C#, Python, Ruby, and JavaScript bindings. To turn it off you can set the capability seleniumManagerEnabled to false or export the environment variable SE_SELENIUM_MANAGER_ENABLED=false.
In networks that block direct internet access, point Selenium Manager to an internal mirror with SE_SELENIUM_MANAGER_DOWNLOAD_URL=https://internal.example.com/drivers.
Worked example: Python test that needs no driver path
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
options = webdriver.ChromeOptions()
# Uncomment to run headless
# options.add_argument('--headless')
driver = webdriver.Chrome(service=Service(), options=options)
driver.get('https://example.com')
print(driver.title)
driver.quit()
Save the script as demo.py and run it from a terminal:
- Install Selenium (if not already):
pip install selenium - Execute:
python demo.py
The first run will trigger a download; you should see a log line similar to:
Selenium Manager: downloading driver for chrome version 115.0.0
Subsequent runs reuse the cached driver, producing a line like:
Selenium Manager: using cached driver for chrome version 115.0.0
Verifying that Selenium Manager worked
- Check the console output for the “downloading driver” or “using cached driver” message.
- After the first run, look for the binary in
~/.seleniummanager/cache(Linux/macOS) or%USERPROFILE%\.seleniummanager\cache(Windows). - Run the test again and confirm the startup time is noticeably shorter because the driver is not downloaded again.
Limitations and practical checks
Limited internet access: If the machine cannot reach the official driver servers, Selenium Manager will fail with an error about being unable to download the driver. The workaround is to set SE_SELENIUM_MANAGER_DOWNLOAD_URL to an internal mirror or to pre‑place a matching driver in the PATH or cache directory.
Cache growth: Over time the ~/.seleniummanager directory can accumulate many driver versions, especially in CI pipelines that test multiple browser versions. A simple cleanup step—deleting the cache directory or pruning old versions—keeps disk usage under control.
Browser not installed: Selenium Manager throws a clear error if it cannot determine the browser version (e.g., “Unable to locate Chrome binary”). Ensure the browser is present and executable before running the test.
Actionable closing
If you are starting a new Selenium project or updating an existing one to Selenium 4.6+, let Selenium Manager handle driver acquisition. Keep an eye on the cache directory in shared agents, configure a mirror for restricted networks, and disable the feature only when you have a compelling reason to manage drivers yourself. This approach reduces boilerplate, improves reproducibility, and lets you focus on writing tests rather than hunting down driver binaries.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.