• Selenium 3.0火狐环境搭建


    selenium 2操作火狐浏览器时不需要驱动,3.0之后版本需要安装驱动,

    由于会有驱动与浏览器版本兼容性问题,配置好环境之后不一定能执行

    下面提供笔者成功执行的版本:

    火狐:en版49.00   各版本下载地址 http://ftp.mozilla.org/pub/firefox/releases/49.0/win32/

    驱动:geckodriver-v0.13.0-win64

    selenium:3.01

    测试代码为:

    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.*;
    
    public class test5 {
        public static void main(String args[]){
        System.setProperty("webdriver.gecko.driver", "C:\Program Files (x86)\Mozilla Firefox\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.baidu.com");
    
        }
    }

    使用驱动:geckodriver-v0.16.1-win64报错如下

    1496125555396 geckodriver::marionette INFO Starting browser \?C:Program Files (x86)Mozilla Firefoxfirefox.exe with args ["-marionette"]
    1496125555659 addons.manager ERROR startup failed: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIFile.create]"

    驱动改为:geckodriver-v0.13.0-win64后成功执行:

    演示视频:

  • 相关阅读:
    PAT L2-014【二分】
    CodeForces 137C【贪心+优先队列】
    CodeForces 131D【图特性+BFS】
    CodeForces 125D【鸽巢原理】
    PAT1060【大模拟啊】
    CodeForces 124C【连通块】
    PAT 1071【STL string应用】
    CodeForces 116C 【BFS】
    CodeForces 116B【二分匹配】
    CodeForces 118C 【模拟】
  • 原文地址:https://www.cnblogs.com/tim2016/p/6920414.html
Copyright © 2020-2023  润新知