zoukankan      html  css  js  c++  java
  • selenium 常见问题

    启动selenium时报错如下异常:

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

    解决方式:需要下载geckodriver,并放在path的环境变量下,下载地址:https://github.com/mozilla/geckodriver/releases

    启动selenium时报异常:selenium.common.exceptions.WebDriverException: Message: Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided, and no binary flag set on the command line

    解决方法1:

    找到Python27Libsite-packagesseleniumwebdriverfirefoxwebdriver.py文件将构造方法中firefox_binary=None的值改为当前firefox的安装路径。如下

    解决方法2:

    在创建webdriver时,将firefox.exe可执行文件路径当做参数传递给webdriver。如下

    启动selenium时报异常:selenium.common.exceptions.WebDriverException: Message: Unsupported Marionette protocol version 2, required 3

    解决方法:firefox 版本太低,需要升级firefox浏览器版本

    启动selenium时,报异常:selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

    原因:geckodriver 版本与firefox浏览器版本不匹配

    下载匹配的版本即可,当前试过的版本:geckodriver-v0.11.1-win64 能与firefox v47.2 可以正常启动firefox。

  • 相关阅读:
    NOI2015 小园丁和老司机
    退役记
    留言板
    $mathfrak {reputation}$
    计算几何基础
    HNOI2018简要题解
    JXOI2018简要题解
    BJOI2018简要题解
    HAOI2018 简要题解
    CQOI2018简要题解
  • 原文地址:https://www.cnblogs.com/JcHome/p/10747328.html
Copyright © 2011-2022 走看看