以下WebDriver Java代码片段应可以启动IE。该代码将忽略IE浏览器中所有区域的保护模式设置。
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
File file = new File("D:\\Ripon Al Wasim\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver(capabilities);
driver.get("/");
下载IEDriverServer并将其解压缩到所需位置并设置绝对路径(在我上面的示例中为“ D:\ Ripon Al Wasim \ IEDriverServer.exe”)