selenium中启动IE浏览器时,需先下载IE浏览器的驱动,将驱动存放在D盘下,代码如下:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class KeywordBrowserIE {
public static void main(String[] args) {
//IE驱动存放路径
System.setProperty("webdriver.ie.driver", "D:\\IEDriverServer_x64_2.52.0\\IEDriverServer.exe");
//实例化WebDriver对象,启动IE浏览器
WebDriver driver = new InternetExplorerDriver();
driver.get("http://www.baidu.com");
driver.quit();
}
}