下面是关于使用selenium和python为twitter制作一个web 刮板的教程,我遇到了这个错误。
File "C:\Python34\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
self.service.start()
File "C:\Python34\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
我去了错误中指定的网站并下载了驱动程序。然后我将它添加到path中,方法是转到System > Advanced > Environment变量> path > New,并将exe文件添加到Path中。我又试了一次,结果还是出了差错。
发布于 2017-10-26 22:44:34
如果你看看你的例外:
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
在指示url,您可以看到开始使用桌面上的ChromeDriver (Windows、Mac、Linux)。
凡有文字的地方:
这些步骤中的任何一步都应该起作用:
如果不能将ChromeDriver位置包含在PATH环境变量中,可以尝试使用第三个选项:
import time
from selenium import webdriver
driver = webdriver.Chrome('/path/to/chromedriver') # Optional argument, if not specified will search path.
driver.get('http://www.google.com');
https://stackoverflow.com/questions/46964509
复制相似问题