安装了python2,使用pip安装了selenium,但是在使用时,报了“selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.”

网上查了一下解决办法,此处做下记录:

原因:使用pip安装selenium,默认安装的是最新版本的selenium,使用pip list查了一下我的selenium版本,是3.5.0的,firefox版本,是47.0.2的,selenium 3.x开始,webdriver/firefox/webdriver.py的__init__中,executable_path="geckodriver";而2.x是executable_path="wires"

方法一:可以卸载现有的selenium,安装指定的2.X版本的selenium,这个办法没有试,因为就是本着selenium3来的,不打算降版本;

方法二:下载geckodriver.exe

  1. 下载地址:https://github.com/mozilla/geckodriver/releases,根据自己的电脑,下载的win64位的;
  2. 在firefox的安装目录下,解压geckodriver,然后将该路径添加到path环境变量下,不报这个错了;
  3. 但是,报了一个新的错“selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities”;
  4. 继续网上查,原因是,我下载的geckodriver是V0.16.1版本的,这个版本和selenium3.4.2不兼容,需要使用deckdriverV0.15的版本;
  5. 重新下载了deckodriverV0.15的版本,ok了,不报这个错了,但是,又报了一个新的错“selenium.common.exceptions.WebDriverException: Message: Unsupported Marionette protocol version 2, required 3;
  6. 继续往上查原因,说是firefox版本太低了,需要升级到最新版,ok,更新firefox,问题解决。\
  7. 火狐浏览器的安装文件.exe也添加到path环境变量中,避免出现一些不不要的错误

python无法启动火狐浏览器且报错“selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities”的更多相关文章

  1. robotframework执行用例时,报错selenium.common.exceptions.WebDriverException: Message: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinl

    在用robotframework编写移动端测试用例(用chrome浏览器模拟手机浏览器),执行用例时, 报错selenium.common.exceptions.WebDriverException: ...

  2. 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 ...

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

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

  4. 【Selenium】【BugList6】调用IE,未启用保护模式,报:selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.

    >>> driver = webdriver.Ie() 解决方法: 1.打开Ie浏览器 , 工具 ->Internet选项 ->安全 2.去掉4个区域的安全保护模式

  5. 【Python + Selenium】初次用IE浏览器之报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones.

    初次用IE浏览器运行自动化程序时,报错:selenium.common.exceptions.WebDriverException: Message: Unexpected error launchi ...

  6. python+selenium,打开浏览器时报selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH

    有一年多没写web自动化了,今天搭建环境的时候报了一个常见错误,但是处理过程有点闹心,报错就是常见的找不到驱动<selenium.common.exceptions.WebDriverExcep ...

  7. Selenium click不生效 报错selenium.common.exceptions.InvalidArgumentException

    记录在使用selenium过程中踩的坑------ 在使用selenium时,用click点击网站弹出的文件上传框的"上传文件"按钮不生效,报错selenium.common.ex ...

  8. appium常见问题03_appium脚本报错selenium.common.exceptions.WebDriverException

    运行appium脚本时报错selenium.common.exceptions.WebDriverException...,如下截图: 该报错说明appium和app的内置chrome版本不一致 [解 ...

  9. python+selenium遇到元素定位不到的问题,顺便记录一下自己这次的错误(报错selenium.common.exceptions.NoSuchElementException)

    今天在写selenium一个发送邮件脚本时,遇到一些没有找到页面元素的错误.经过自己反复调试,找原因百度,终于解决了.简单总结一下吧,原因有以下几点: 一:Frame控件嵌套,.Frame/Ifram ...

随机推荐

  1. Java可变参数与Collections工具类使用了解

    今天发现jdk1.5后增加了个可变参数,以前还一直不晓得 public static void main(String[] args) { System.out.println(getNum(1,2, ...

  2. mysql 存中文失败问题

    在向数据库存中文时报错: 将中文字段的字符集改为utf8即可: 成功截图:

  3. python随机数(转载)

    随机生成 0 到 1 之间的浮点数 random.random() 方法会返回 [0.0, 1.0) 之间的浮点数,注意,这是一个左闭右开的区间,随机数可能会是 0 但不可能为 1 . 随机生成 a ...

  4. c语言学习笔记 - 二进制文件

    在进行文件操作的时候,有时候是用文本的形式存在文件里面,例如用 fprintf(fp,"%d",123) 存一个数据123,实际的存储是已1,2,3这3个ASCII码存入,打开文件 ...

  5. Chrome快捷键, Mac 下 Chrome 浏览器 快捷键

    Chrome窗口和标签页快捷键:Ctrl+N 打开新窗口 Ctrl+T 打开新标签页 Ctrl+Shift+N 在隐身模式下打开新窗口 Ctrl+O,然后选择文件 在谷歌浏览器中打开计算机上的文件 按 ...

  6. 微信开发SDK支持小程序 ,Jeewx-Api 1.3.1 版本发布

    JEEWX-API 是一款JAVA版的微信开发SDK,支持微信公众号.小程序.微信企业号.支付宝生活号SDK和微博SDK.你可以基于她 快速的傻瓜化的进行微信开发.支付窗开发和微博开发. 基于jeew ...

  7. Spring MVC(十)--通过表单序列化传递参数

    通过表单序列化传递参数就是将表单数据转化成字符串传递到后台,序列化之后参数请求变成这种模式param1=value1&&param2=value2,下面用代码实现. 1.创建表单 &l ...

  8. python学习笔记3.2_数据导出

    一.data.to_csv:数据导出 1.to_csv:将数据导出为逗号分隔的文件 2.输出为其他分隔符的文件 写入到控制台,并打印:sys.stdout na_rep:对空值进行标注 二.serie ...

  9. Ubuntu下U盘能看见盘符但打不开

    查看U盘状态 sudo fdisk -l 格式化 sudo mkfs -t vfat -I /dev/sdb1 sudo mkfs -t ntfs -I /dev/sdb1 sudo mkfs -t ...

  10. Angular+Bootstrap3导航菜单

    Angular+Bootstrap3导航菜单 AngularJS体验式编程系列文章,将介绍如何用angularjs构建一个强大的web前端系统.angularjs是由Google团队开发的一款非常优秀 ...