Я тестирую сайт, где есть ссылки, которые открываются в новой вкладке.Он работает вручную для IE, FireFox и Chrome и с Selenium для FireFox и Chrome, но не для IE, ничего не делает и ошибок нет.
Я проверил код
HTML:
<a id="idA"></a>
JS:
$("#idA").on("click", function () {
window.open("urlToOpen", "_blank");
}
Java:
(definition of the driver)
System.setProperty("webdriver.ie.driver","pathToMyDriverIE");
InternetExplorerOptions internetExplorerOptions = new InternetExplorerOptions();
internetExplorerOptions.setCapability("RequireWindowFocus", true);
internetExplorerOptions.setCapability("EnablePersistentHover", true);
internetExplorerOptions.setCapability("EnableNativeEvents", true);
internetExplorerOptions.setCapability("ignoreZoomSetting", true);
internetExplorerOptions.setCapability("ie.ensureCleanSession", true);
internetExplorerOptions.setCapability("enableElementCacheCleanup", true);
internetExplorerOptions.destructivelyEnsureCleanSession();
internetExplorerOptions.setCapability("ignoreProtectedModeSettings", true);
internetExplorerOptions.setCapability("UnexpectedAlertBehavior", UnexpectedAlertBehaviour.ACCEPT);
internetExplorerOptions.setCapability("IntroduceInstabilityByIgnoringProtectedModeSettings", true);
internetExplorerOptions.setUnhandledPromptBehaviour(UnexpectedAlertBehaviour.ACCEPT);
driver = new InternetExplorerDriver(internetExplorerOptions);
(function to click on the link)
public void clickOnLink(boolean withJs){
WebElement W = driver.findElement(By.id("idA"));
if(withJs){
((JavascriptExecutor)driver).executeScript("arguments[0].click();", W);
}
else{
W.click();
}
}
Я думаю, что сделать это вручную, при открытии нового окна (потому что мне нужно взаимодействовать с после, и это трудно сделать сIE в новой вкладке), но я не могу получить ссылку, определенную в JS.Без _blank нет проблем.
У кого-то есть идея?
Selenium: 3.11.0;InternetExplorerDriver: 3,9 (32 бита);JDK8
Заранее спасибо.