zoukankan      html  css  js  c++  java
  • selenium 3.0与2.0 打开火狐浏览器的区别

    3.0的selenium需要引入gecko.driver驱动 ,因为没有在系统环境path中配置相关路径,因此需要特别指出,为了方便使用,建议直接和火狐安装包中的.exe文件放在同一目录下。

    2.0的selenium有自带驱动,并不需要额外引入,只需要指明firefox.exe的所在位置即可。

    以下是3.0打开浏览器中main函数中的内容

    public static void main(String[] args) {

    System.setProperty("webdriver.gecko.driver", "D:/firefox-47.0.1.win64.sdk/firefox-sdk/bin/geckodriver.exe");
    // 针对selenium3.0以上 需要引入gecko.driver,才能正常运行。
    WebDriver drive = new FirefoxDriver();

    drive.get("https://www.baidu.com");

    }

    以下是2.0打开浏览器中main函数中的内容

    public static void main(String[] args) throws InterruptedException {
    WebDriver driver;
    System.setProperty("webdriver.firefox.bin", "D:/firefox29.0/firefox.exe");

    // WebDriver dirver = new FirefoxDriver();
    driver = new FirefoxDriver();

    drive.get("https://www.baidu.com");

    }

  • 相关阅读:
    UVA Live Achrive 4327 Parade (单调队列,dp)
    从磁盘读取一个文件到内存中,再打印到控制台
    二分查找法
    日期:Date
    线程与进程
    泛型基本知识
    泛型
    Map集合的遍历方式:
    Arrays
    Set接口
  • 原文地址:https://www.cnblogs.com/linxinmeng/p/6924529.html
Copyright © 2011-2022 走看看