一、启动浏览器
Selenium API :
1、启动Firefox浏览器
。准备工作
下载firefox驱动geckodriver(注意浏览器的版本)
火狐浏览器的版本
package cn.test;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class OpenBrower_Firefox {
private WebDriver driver;
@Before
public void setUp() {
System.setProperty("webdriver.gecko.driver", "libs/geckodriver.exe");
driver = new FirefoxDriver();
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void openBrower() throws Exception {
driver.get("https://www.baidu.com/");
Thread.sleep(2000);
<