selenium.common.exceptions.WebDriverException: 消息:在Windows操作系统上使用Python3时无法连接到"chromedriver"错误



我正在使用Windows 7 OS,并尝试使用Eclipse Pydev IDE的Python运行Selenium Webdriver测试。我已经下载了Google Chrome驱动程序,并将其添加到我的路径中。我还将chromedriver.exe添加到C:Python34Scripts。我尝试了以下内容:

from selenium import webdriver
driver = webdriver.Chrome()

我收到错误消息

selenium.common.exceptions.webdriverexception:消息:无法连接到'Chromedriver'

当我尝试运行脚本时。我也尝试了以下内容:

driver = webdriver.Chrome(executable_path="C:folderchromedriver.exe")

我收到一条消息,说找不到文件。如果我从终端尝试以下内容:

driver = webdriver.Chrome() 

浏览器是启动的,因此可以从终端起作用。问题是从Eclipse运行我的脚本。

我在ubuntu上使用此功能,但我遇到了同样的错误,问题是我对Chrome驱动程序文件没有sym链接,

在ubuntu中是 sudo ln -s ~/selgrid/chromedriver /usr/local/bin/chromedriver

这可能会有所帮助http://www.howtogeek.com/howto/16226/complete-guide-to-symbolic-links-links-symlinks-on-windows-on-windows-or-linux/

祝你好运!

最新更新