Issue with Popup window | Selenium Forum
M
Posted on 23/04/2016
I am trying to get a handle of the popup but my Window.size output still shows 1 , but there is a popup on the page.
Why it does not identify the popup window.

I am unable to get the id of the popup due to this.

M
Replied on 23/04/2016

give me your code.


M
Replied on 24/04/2016

Set<String> winIds = driver.getWindowHandles();
System.out.println("Total windows -> "+ winIds.size());

if(winIds.size() == 2){
Iterator<String> iter = winIds.iterator();
String mainWinID = iter.next();
String popupWinID = iter.next();
driver.switchTo().window(popupWinID);
driver.close();
driver.switchTo().window(mainWinID);

}


M
Replied on 25/04/2016

can you give me entire code?

if you can't then please attach screen shot.