python system_error ai_generated true

selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.

ID: python/pytest-selenium-webdriver-exception

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2025-05-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active — — —

Root Cause

Selenium cannot find the ChromeDriver executable. This occurs when ChromeDriver is not installed, not in PATH, or the version is incompatible with the installed Chrome browser.

generic

中文

Selenium 找不到 ChromeDriver 可执行文件。这发生在 ChromeDriver 未安装、不在 PATH 中,或版本与已安装的 Chrome 浏览器不兼容时。

Workarounds

  1. 98% success
    pip install webdriver-manager
    from selenium import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    
    driver = webdriver.Chrome(ChromeDriverManager().install())
  2. 90% success
    driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
  3. 95% success
    Check Chrome version: chrome://version/
    Download matching ChromeDriver from https://chromedriver.chromium.org/

Dead Ends

Common approaches that don't work:

  1. 70% fail

    If the version is incompatible with Chrome, Selenium will still fail with a different error.

  2. 80% fail

    This relies on PATH and may fail if chromedriver is not installed system-wide.

  3. 90% fail

    Does not solve the missing driver issue and may introduce other incompatibilities.