【发布时间】:2021-08-26 07:51:52
【问题描述】:
在你给我打分之前,我必须说我阅读了这个网站上几乎所有关于谁遇到了我同样的问题的答案,但我没有找到答案。
例如 there 提出问题的人接受了第一个答案,但在答案中复制粘贴代码时出现了相同的错误。
另一个示例there 链接到this video,它没有解释太多,但没有引发错误,而不是我从视频中复制的代码。 (他不写.exe,所以他的代码中可能也会发现错误)
This one 有完全相同的问题,所以它会很完美,但没有答案被接受。
这是错误的最后一行:
selenium.common.exceptions.WebDriverException: Message: 'chrome.exe %s' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
在异常消息的末尾有一个link,表示他们已迁移到另一个站点。
这里的错误信息:
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato
During handling of the above exception, another exception occurred:
#Something else beetwen
selenium.common.exceptions.WebDriverException: Message: 'chrome.exe %s' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
这是我的代码的开头:
from selenium import webdriver
chrome_path = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
driver = webdriver.Chrome(executable_path=chrome_path)
我确定路径是正确的,因为我是从 chrome.exe 属性中复制粘贴的。
我也尝试过不使用 %s,但它引发了不同的错误:
selenium.common.exceptions.WebDriverException: Message: Service C:/Program Files (x86)/Google/Chrome/Application/chrome.exe unexpectedly exited. Status code was: 0
谁能帮我解释一下怎么回事?
谢谢
编辑
我用文件资源管理器搜索“chromedriver”,没有找到。
【问题讨论】:
标签: python-3.x selenium selenium-webdriver selenium-chromedriver