python
system_error
ai_generated
true
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH
ID: python/pytest-selenium-webdriver-error
80%Fix Rate
89%Confidence
0Evidence
2024-04-17First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4.x | active | — | — | — |
Root Cause
Selenium cannot find the ChromeDriver executable. This occurs when ChromeDriver is not installed, not in PATH, or the version does not match the installed Chrome browser.
generic中文
Selenium 无法找到 ChromeDriver 可执行文件。这发生在 ChromeDriver 未安装、不在 PATH 中,或版本与已安装的 Chrome 浏览器不匹配时。
Workarounds
-
95% success
from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.service import Service driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
-
92% success
from selenium import webdriver driver = webdriver.Chrome() # Auto-downloads driver
Dead Ends
Common approaches that don't work:
-
80% fail
This makes tests non-portable and breaks on other machines or CI environments with different paths.
-
70% fail
This works locally but is not reproducible. The driver may be outdated or incompatible with the browser version.