![](/img/trans.png)
[英]Exception (org.openqa.selenium.NoSuchWindowException): using Selenium WebDriver with Java in Internet Explorer
[英]IE 11 with Selenium WebDriver: org.openqa.selenium.NoSuchWindowException
我不知道为什么,如果我设置断点(请参见代码),它的工作(即单击),但是如果我刚运行,我的行(JavascriptExecutor)上会有一个异常org.openqa.selenium.NoSuchWindowException...。也许有人现在可以帮助我,或者有人知道如何忽略IE中的证书。 谢谢。
public class ie {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.ie.driver", "drivers/iexploredriver.exe");
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
//caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver = new InternetExplorerDriver(caps); // there i setting break point
driver.get("https://sasdka.test/uk/");
((JavascriptExecutor) driver).executeScript("document.getElementById('overridelink').click()");
driver.quit();
}
}
Open Internet Options and switch to "Security" Tab Select the "Internet" Zone and Unselect the Checkbox "Enable Protected Mode". Apply this and do this for remaining 3 zones: "Local intranet", "Trusted sites" and "Restricted sites". After this, close the Internet Options and Restart Internet Explorer to get these changes reflected.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.