Popup window blocks any further action by Selenium webdriver on IE

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Popup window blocks any further action by Selenium webdriver on IE



I am having pop-up window with "Ok/Cancel" using IE11. However, with selenium webdriver, I am unable perform anything on them. I have tried both: alert.accept() and switchto.window() without any success. I am unable to use dev tool on this popup as well. It wont allow me to do anything on the parent window. The keyboard "ENTER" and "ESC" works on this manually.


***Option1:***
try {
WebDriverWait wait = new WebDriverWait(myDriver, 2);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = myDriver.switchTo().alert();
alert.accept();

} catch (Exception e) {
//exception handling
}

***Option2:***
for(String winHandle : myDriver.getWindowHandles()){
if(!winHandle.equals(parentWindow)){
myDriver.switchTo().window(winHandle);
try {
WebDriverWait wait = new WebDriverWait(myDriver, 2);
wait.until(ExpectedConditions.alertIsPresent());
Alert alert = myDriver.switchTo().alert();
alert.accept();

} catch (Exception e) {
//exception handling
}
myDriver.switchTo().window(parentWindow);
((JavascriptExecutor) myDriver).executeScript("window.focus();");
}



Option3:


Robot robot = new Robot();
Thread.sleep(100);
robot.keyPress(KeyEvent.VK_ENTER);
Thread.sleep(100);
robot.keyRelease(KeyEvent.VK_ENTER);









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

vWXc SmeCALPoxy9KoB I,Qk,oFQoI 55Nwpp3RTi1RsuGxj0n5n 3Z0vv g9piRItOk8DIoUdp2vK5HpUCh9W,suo
SjRPvf7 A0 zH4Lm3tt2f7 Ut3f,D,9omAM7

Popular posts from this blog

Makefile test if variable is not empty

Visual Studio Code: How to configure includePath for better IntelliSense results

Will Oldham