操作系统:Windows 7
Selenium版本:3.10.0
浏览器:Internet Explorer 11
您好, 单击弹出消息上的按钮时,IE-11中的测试失败。能够在网页上找到所需元素,但点击操作失败。这是间歇性错误,因为有时点击会起作用并且测试会运行。
我也设置了ie功能。
dCaps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
dCaps.setCapability(InternetExplorerDriver.
INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
dCaps.setCapability("nativeEvents", false);
dCaps.setJavascriptEnabled(false);
dCaps.setCapability("unexpectedAlertBehaviour", "accept");
dCaps.setCapability("ignoreProtectedModeSettings", true);
dCaps.setCapability("disable-popup-blocking", true);
dCaps.setCapability("enablePersistentHover", true);
dCaps.setCapability("introduceInstabilityByIgnoringProtectedModeSettings", true);
dCaps.setCapability("ie.ensureCleanSession", true);
dCaps.setCapability(InternetExplorerDriver.ENABLE_ELEMENT_CACHE_CLEANUP, true);
以下是我使用过的点击方法
Actions actions = new Actions(driver);
actions.moveToElement(webElement);
actions.click();
actions.build().perform();