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。

  • 相关阅读:
    下载并使用ASP.NET MVC v1.0 Futures
    关于DataGridView的数据源两个值得注意的小问题
    C++网络编程(二)客户端服务器程序
    C++多态、继承的简单分析
    XML文件解析器TXml
    数组
    CTS类型系统
    光阴不会虚度
    软件的大规模生产
    微创新和山寨的关系
  • 原文地址:https://www.cnblogs.com/JcHome/p/10747328.html
Copyright © 2011-2022 走看看