python
system_error
ai_generated
true
selenium.common.exceptions.WebDriverException: 消息: 'chromedriver' 可执行文件需要在 PATH 中。
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH.
ID: python/pytest-selenium-webdriver-exception
80%修复率
87%置信度
0证据数
2025-05-05首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
Selenium 找不到 ChromeDriver 可执行文件。这发生在 ChromeDriver 未安装、不在 PATH 中,或版本与已安装的 Chrome 浏览器不兼容时。
English
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.
解决方案
-
98% 成功率
pip install webdriver-manager from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager driver = webdriver.Chrome(ChromeDriverManager().install())
-
90% 成功率
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
-
95% 成功率
Check Chrome version: chrome://version/ Download matching ChromeDriver from https://chromedriver.chromium.org/
无效尝试
常见但无效的做法:
-
70% 失败
If the version is incompatible with Chrome, Selenium will still fail with a different error.
-
80% 失败
This relies on PATH and may fail if chromedriver is not installed system-wide.
-
90% 失败
Does not solve the missing driver issue and may introduce other incompatibilities.