• python无法启动火狐浏览器且报错“selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities”


    安装了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环境变量中,避免出现一些不不要的错误
  • 相关阅读:
    asp.net2.0中App_GlobalResources的使用
    KPI(Key Performance Indicators )
    Dictionary集合
    SQL连接查询1 内联接查询
    如何在Web.config中注册用户控件和自定义控件
    JavaScript中【数据类型】和【数组类型】的区别
    递归求斐波拉数列函数
    SQL连接查询2 外连接(左右联接查询)
    启示
    “帽子戏法”从何而来?
  • 原文地址:https://www.cnblogs.com/xiaobucainiao/p/7551863.html
Copyright © 2020-2023  润新知