码迷,mamicode.com
首页 > 其他好文 > 详细

Selenium之IE浏览器的启动

时间:2018-03-30 01:14:15      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:文件   dmi   驱动   string   下载   .exe   需要   import   没有   

1、下载IEDriverServer.exe文件放至需要的目录中;

2、编写代码

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

/**
 * Created by Administrator on 2018/3/29 0029.
 */
public class IETest {
    public static void main(String[] args){
        WebDriver driver;
        //根据下载好的驱动地址进行配置
        System.setProperty("webdriver.ie.driver","D:\\ztsoft\\ieDriverServer\\IEDriverServer.exe");
        //实例化一个对象Chrome
        driver = new InternetExplorerDriver();
        String testUrl = "http://www.baidu.com";
        driver.get(testUrl);
        //driver.quit();
    }
}

3、执行代码,弹出IE浏览器,地址栏中没有展示设置的地址,后续再看。

Selenium之IE浏览器的启动

标签:文件   dmi   驱动   string   下载   .exe   需要   import   没有   

原文地址:https://www.cnblogs.com/biyuting/p/8673306.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!