Selenium之firefox浏览器的启动

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,地址栏输入代码设置的地址。

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