ModuleNotFoundError: No module named 'webdriver_manager' is usually one of two things: you installed it under the wrong name, or you installed it into a different Python than the one running your script. There is also a third possibility worth checking first — since Selenium 4.6, you probably do not need this package at all.
The fix#
python -m pip install webdriver-manager
from webdriver_manager.chrome import ChromeDriverManager
Hyphen when installing, underscore when importing. This mismatch is normal in Python — the name on PyPI and the importable module name are set independently — but it catches almost everyone once.
Check you do not need it#
Selenium 4.6 and later include Selenium Manager, which downloads and matches the correct driver automatically. For most projects that removes the dependency entirely:
from selenium import webdriver
driver = webdriver.Chrome() # driver handled for you
driver.get("https://example.com")
print(driver.title)
driver.quit()
python -m pip install --upgrade selenium
python -c "import selenium; print(selenium.__version__)"
If that version is 4.6 or higher, delete the webdriver-manager import and the Service boilerplate around it. One less dependency and one less thing to break.
Using it when you still need it#
There are legitimate reasons to keep it — an older Selenium you cannot upgrade, or a locked-down environment where you want explicit control over driver caching.
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
service = Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=service)
driver.get("https://example.com")
print(driver.title)
driver.quit()
For Firefox and Edge the pattern is identical:
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver.firefox.service import Service as FirefoxService
driver = webdriver.Firefox(service=FirefoxService(GeckoDriverManager().install()))
When installing did not help#
The install almost certainly succeeded — into a different interpreter. Check both sides:
python -c "import sys; print(sys.executable)"
python -m pip show webdriver-manager
If pip show finds nothing while a bare pip show does, that is the mismatch. Always install with python -m pip.
Inside a virtual environment, globally installed packages are invisible by design:
python -m venv .venv
source .venv/bin/activate # .venv\Scripts\activate on Windows
python -m pip install selenium webdriver-manager
In VS Code, open the command palette and run “Python: Select Interpreter” to point the editor at the same environment your terminal uses.
Running without a visible browser#
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(options=options)
The last two arguments matter inside Docker and CI, where the default shared-memory size is too small and Chrome crashes without an obvious message.
Waiting properly#
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 10)
element = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "h1")))
print(element.text)
Almost every flaky Selenium test comes from acting before the page is ready. Explicit waits like this are the fix; time.sleep() is the thing they replace.
Questions people ask#
Do I still need webdriver-manager?
Usually not, with Selenium 4.6 or later. Keep it only if you are pinned to an older Selenium or need explicit control over where drivers are cached.
Why does the version have to match my browser?
ChromeDriver speaks a protocol tied to a specific Chrome major version. A mismatch produces “This version of ChromeDriver only supports Chrome version NN”. Selenium Manager and webdriver-manager both exist to solve exactly this.
Can I use it with Playwright?
No, and you do not need to. Playwright downloads and manages its own browsers with playwright install.
Why does it work locally but fail in CI?
The CI machine has no browser installed, or no display. Install Chrome in the pipeline and run headless.
Where to go next#
- Python virtual environments — the cause of most install mismatches.
- Web scraping and automation — when requests would be simpler than a browser.
- Fixing ModuleNotFoundError — the same diagnosis in depth.