首页 > 其他 > 详细

Selenium之firefox浏览器的启动

时间:2018-03-29 23:59:56      阅读:324      评论:0      收藏:0      [点我收藏+]

1、编写如下代码

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

/**
 * Created by Administrator on 2018/3/29 0029.
 */
public class FirefoxTest {
    public static void main(String[] args){
        WebDriver driver;
        //启动找不到firefox才需要设置
        System.setProperty("webdriver.firefox.bin","D:\\ztsoft\\Firefox\\firefox.exe");
        //实例化一个对象firefox
        driver =  new FirefoxDriver();
        String testUrl = "http://www.baidu.com";
        driver.get(testUrl);
        driver.quit();
    }

2、执行代码,弹出firefox,地址栏输入代码设置的地址。

Selenium之firefox浏览器的启动

原文:https://www.cnblogs.com/biyuting/p/8673215.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!