问题描述:

执行如下代码

# 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. 130道ASP.NET面试题,我只会80道!

    1. 简述 private. protected. public. internal 修饰符的访问权限.答 . private : 私有成员, 在类的内部才可以访问. protected : 保护成员 ...

  2. 如何在Django1.6结合Python3.4版本中使用MySql

    唉,最近赶了个新潮,用起了Python3.4跟Django1.6,数据库依然是互联网企业常见的MySql. 悲催的是在Python2.7时代连接MySql的MySQLdb还不支持Python3.4,还 ...

  3. win8.1安装开发工具 vs2015 Visual Studio 2015 Preview Downloads

    1.首先全新安装win8.1 略 破解激活.... 2.安装Visual Studio 2015 Visual Studio 2015 是免费的,不存在破解版本, 如果安装过程中存在问题,建议先把本文 ...

  4. [Functional Programming] Use Task/Async for Asynchronous Actions

    We refactor a standard node callback style workflow into a composed task-based workflow. Original Co ...

  5. 《Go并发编程实战》第2版 紧跟Go的1.8版本号

    文章作者:郝林(<Go并发编程实战 (第2版)>作者) 最终来了! 经过出版社的各位编辑.校对.排版伙伴与我的N轮PK和共同努力,<Go并发编程实战>第2版的全部内容最终全然确 ...

  6. android 线程安全

    android ui 不是线程安全的,所以不能在子线程里更新ui,必须到主线程里更新

  7. 首都医科大学附属北京安贞医院全院级PACS系统采购项目[转]

    项目名称:首都医科大学附属北京安贞医院全院级PACS系统采购项目 项目编号:TC140VCF0 采购人名称:首都医科大学附属北京安贞医院 采购人地址:北京市朝阳区安贞里 采购人联系方式:010-644 ...

  8. Shodan:黑客的物联网搜索引擎

    记得看过一个电影.里面的科学家开发了一个超级系统,能够实时监控全部可用摄像头.让逃犯无处遁形. Shodan这个新型的搜索引擎可能会让这个想法变成现实. 和Google这些传统互联网信息搜索引擎不同. ...

  9. swift -类的定义及使用

    // // main.swift // ClassDemo-06 // import Foundation println("Hello, World!") //类的定义 Pers ...

  10. 转:不在同一个服务器上的数据库之间的数据操作(oracle/sql server的对比)

    如何操做不在同一个数据库中的数据操作: 一.对于SQL server来讲:  1.采用创建链接服务器的方式:    (1).创建链接服务器       exec sp_addlinkedserver  ...