问题描述:

执行如下代码

# coding=utf-8
from selenium import webdriver driver = webdriver.Firefox()
driver.maximize_window()
driver.implicitly_wait(2) driver.get('https://www.baidu.com')
try:
driver.find_element_by_id('kw')
print('test pass: ID found')
except Exception as e:
print('Exception found', format(e)) driver.quit()

提示报错:

Traceback (most recent call last):
File "E:/PythonSelenium/CSDN/004id.py", line 4, in <module>
driver = webdriver.Firefox()
File "E:\Python35\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 142, in __init__
self.service.start()
File "E:\Python35\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: 'geckodriver' executable needs to be in PATH.

原因分析:

摘取主要报错信息 Message: 'geckodriver' executable needs to be in PATH.

解决方法:

(1)测试环境:Selenium 3.4.0   Firefox 56.0   Python3.5.2

(2)下载火狐浏览器对应驱动,传送门 https://github.com/mozilla/geckodriver/releases   结合我浏览器的版本需要下载V 0.19.0

(3)解压文件获取geckodriver.exe文件,并放置在主目录下。重新运行后发现问题已解决。

注:注意火狐浏览器、Python环境变量设置。

Message: 'geckodriver' executable needs to be in PATH. 解决方法的更多相关文章

  1. windows下使用selenium报错selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH

    问题 :执行程序代码报错: WebDriverException:Message:'geckodriver'executable needs to be in Path 或者 selenium.com ...

  2. selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 错误处理方法

    首次使用selenium webdriver,webdriver.Firefox() 报错selenium.common.exceptions.WebDriverException: Message: ...

  3. selenium使用报错“selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.”

    安装了python3,使用pip安装了selenium,但是在使用时,报了“selenium.common.exceptions.WebDriverException: Message: 'gecko ...

  4. Message: 'geckodriver' executable needs to be in PATH

    1.下载geckodriver.exe:下载地址:mozilla/geckodriver请根据系统版本选择下载:(如Windows 64位系统) 2.下载解压后将getckodriver.exe复制到 ...

  5. 【Selenium】【BugList2】geckodriver未安装,报:WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

    环境信息:Windows7 64位 + python 3.6.5 + selenium 3.11.0 +pyCharm #coding=utf-8 from selenium import webdr ...

  6. Go丨语言package github.com/Go-SQL-Driver/MySQL: exec: "git": executable file not found in %PATH%解决方法

    Go语言在添加第三方MySQL驱动的时候报错: go: missing Git command. See https://golang.org/s/gogetcmd package github.co ...

  7. Path通过Selenium模拟浏览器抓取,Windows 64解决selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.方法

    1.下载geckodriver.exe: 下载地址:https://github.com/mozilla/geckodriver/releases请根据系统版本选择下载:(如Windows 64位系统 ...

  8. WebDriverException:Message:'geckodriver'executable needs to be in Path

    geckodriver是一原生态的第三方浏览器,对于selenium3.x版本都会使用geckodriver来驱动firefox,所以需要下载geckodriver.exe,下载地址:https:// ...

  9. selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

    http://www.seleniumhq.org/download   1. selenium 3.x开始,webdriver/firefox/webdriver.py的__init__中,exec ...

随机推荐

  1. Android Studio如何集成Genymotion

    转自:http://blog.csdn.net/hyr83960944/article/details/37900383 Android Studio集成Genymotion比在Eclipse中集成简 ...

  2. Java编程兵书

    <Java编程兵书> 基本信息 作者: 桂颖 任昱衡 丛书名: 程序员藏经阁 出版社:电子工业出版社 ISBN:9787121207419 上架时间:2013-8-26 出版日期:2013 ...

  3. java如何判断编码是否是utf8编码

    String的getBytes()方法是得到一个系统默认的编码格式的字节数组getBytes("utf-8")  得到一个UTF-8格式的字节数组 把String转换成bytes, ...

  4. python 下载安装setuptools及pip应用

    1.首先下载python安装程序,下载地址:https://www.python.org/download/releases/2.7.8/ 如下图: 因为我的机器是32位的就选择了Windows x8 ...

  5. Tags Used In OpenERP 7.0

    In OpenERP 7.0. the form view of each object has been redesigned so that the object the user is work ...

  6. 基于SSM + Redis的Shiro权限管理项目

    概述 本教程结合SSM(SpringMVC + Mybatis)框架讲解Shiro,讲解的内容有自定义shiro拦截器,Shiro Freemarker标签,Shiro JSP标签,权限控制讲解. 详 ...

  7. Android Studio集成SVN报错:can&#39;t use subversion command line client : svn

    Android Studio集成SVN插件,check out出代码后.每次开启都会在右上角出现例如以下错误: Can't use Subversion command line client: sv ...

  8. 从Intellij IDEA14 SpringMVC4+Hibernate4问题得到的启发

    1.在添加model类hibernate注解的时候,idea一直提示没有配置数据源(其实是假报错,浪费我这么长时间,感觉idea还是和vs有很大的差距)! 2.解决上面的问题,又报错,原来id的注解写 ...

  9. Android数据库升级实例

    第一部分 Andoird的SQLiteOpenHelper类中有一个onUpgrade方法.帮助文档中只是说当数据库升级时该方法被触发.经过实践,解决了我一连串的疑问: 1. 帮助文档里说的“数据库升 ...

  10. Eclipse怎样连接并打开oracle等数据库?

    http://jingyan.baidu.com/article/a501d80cea3ed4ec630f5e2f.html