public class Testcase { @Test public void test() throws InterruptedException { System.setProperty("webdriver.ie.driver", "C:\\IEDriverServer.exe"); //为 Internet Explorer 设置安全性功能, DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer(); ieCapabilities.setCapability(InternetExplorerDriver. INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true ); WebDriver driver; String url; url = "http://www.baidu.com"; driver = new InternetExplorerDriver(ieCapabilities); driver.get(url); System.out.print(driver.getTitle()); driver.quit(); } }