1. 启动IE浏览器需要一个驱动:IEDriverServer.exe
下载地址:http://docs.seleniumhq.org/download/
代码:
DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
capability.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
capability.setVersion("9");
capability.setPlatform(Platform.WINDOWS);
capability.setBrowserName("internet explorer");
System.setProperty("webdriver.ie.driver","D:\\IEDriverServer.exe");
dr = new InternetExplorerDriver(capability);
2.启动chrome浏览器
System.setProperty("webdriver.chrome.driver","chrome浏览器地址");
dr = new ChromeDriver();