getWindowHandles not working properly with latest edge browser version

196 views Asked by At

I am working on an application which supports only Edge Browser. The login functionality works as follows - On the login screen, when username and password values are provided and login button is clicked, a new browser window opens with an active alert pop-up saying Login Successful along with OK button similar to the image below -
Example for new window with alert Pop-up

Also, when this new window opens, the old browser window goes blank. When user clicks on this OK button (or hits ENTER button on keyboard), user home page loads on this new browser window itself and the old window remains black throughout the session.

Automation -

To handle this flow in automation, I have used getWindowHandles() method where I get the handle of this newly opened window and accept the alert. This used to work properly till edge browser version 105. However, when the edge browser version was upgraded to 107, I started facing the issue where the getWindowHandles() method goes into infinite loop and eventually the test times out. I also tried to simulate ENTER button hit by using Robot class but it made no difference. I have tried using the edge-driver version matching with the current browser version 107 but the issue persists.

Can someone please let me know what can be done for this? Is these any known issue with newer edge browser version? Thanks in advance..!!

This is the code written to handle multiple windows and the test times out at getWindowHandles() method itself.

for(String wh : driver.getWindowHandles()){
    driver.switchTo().window(wh);
}
1

There are 1 answers

0
Kendrick Li On

Adding a Wait may be the key to this problem:

WebDriverWait wait = new WebDriverWait(driver,20);

BTW, I've tested in Edge 108 (also with Edge Driver 108). There's no such error message and everything works great. You can upgrade to 108 and see whether this issue has been fixed.