【问题标题】:WebDriverException: Message: 'ChromeDriver executable needs to be available in the pathWebDriverException:消息:'ChromeDriver 可执行文件需要在路径中可用
【发布时间】:2014-09-11 03:23:55
【问题描述】:

每次我运行我的 python 算法时,我都会在 cmd 中收到此错误:

Traceback (most recent call last):
File "newScrape.py", line 1, in <module>
import SScraper as SS
File "build\bdist.win32\egg\SScraper\__init__.py", line 45, in <module>
File "C:\Python27\lib\site-packages\selenium-2.43.0-py2.7.egg\selenium\webdriv
er\chrome\webdriver.py", line 59, in __init__
self.service.start()
File "C:\Python27\lib\site-packages\selenium-2.43.0-py2.7.egg\selenium\webdriv
er\chrome\service.py", line 68, in start
and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable
needs to be available in the path.                 Please download from http://
chromedriver.storage.googleapis.com/index.html                and read up at htt
p://code.google.com/p/selenium/wiki/ChromeDriver'

这是我的环境路径 C:\Program Files\Java\jdk1.8.0_05\bin;C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\; C:\文件\chromedriver.exe;

我做错了什么?

【问题讨论】:

    标签: python google-api webdriver selenium-chromedriver traceback


    【解决方案1】:

    您只需将C:\FILES\chromedriver.exe 替换为C:\FILES,因为PATH 环境变量包含分号分隔的目录列表。

    【讨论】:

    • 谢谢伙计,它现在改变了,但我仍然遇到同样的错误。我整天都在玩它不同的组合和重新启动等
    • @ConnorStansfield 好的,不确定是否重要,但请省略结尾的 ;C:\FILES 之前的空格。
    • C:\Program Files\Java\jdk1.8.0_05\bin;C:\Python27;C:\Python27\Lib\site-packages\;C:\Python27\Scripts\;C: \文件\
    • @ConnorStansfield 好的,我假设这没有帮助。如果在实例化驱动程序时明确指定executable_path 会怎样:driver = webdriver.Chrome(executable_path='C:\FILES\chromedriver.exe')
    • 我又试了一次,现在它已经开始工作了哈哈非常感谢! =]
    猜你喜欢
    • 1970-01-01
    • 2015-07-03
    • 2022-10-21
    • 1970-01-01
    • 2022-12-03
    • 2017-03-04
    相关资源
    最近更新 更多