Window size always returning 1 even there are multiple windows open | Selenium Forum
U
Upendar Posham Posted on 24/09/2021

Below is the example code which someone posted earlier

Hi,

In chrome browser trying to access pop up from one UI link. but through getWindowHandles always getting size as 1 and not able to identify other child windows. i used delay ( thread.sleep) as well afetr click on filter icon to open up other pop up.

Please suggest work around.

after navigating to URL - home page Here is the code

refundMethodFiltericon.click();
 
Thread.sleep(5000);
Set<String> s = driver.getWindowHandles();
Iterator<String> it = s.iterator();
System.out.println("total windows " + s.size());

String childWindow = null;

while (it.hasNext()) {
childWindow = it.next();
}

System.out.println("childwindow Id " + childWindow);
driver.switchTo().window(childWindow);
String refundMethodTitle = driver.getTitle();
System.out.println("driver of child tittle" + refundMethodTitle);

 

it is seperate browser window we have to switch

but getting size only one unable to switch 


U
Upendar Posham Replied on 24/09/2021

Much appreciated if provide suggestions as soon as possible because it is a blocker for us


A
Ashish Replied on 25/09/2021

Can you send screenshot.

Sometmes a light box comes and its part of same page though it appears to be a new popup

Please verify that


U
Upendar Posham Replied on 25/09/2021

Thanks so much  for quick response

I verified and looks it's not a light box I think

its a seperate browser window 

 


U
Upendar Posham Replied on 27/09/2021

Can you suggest on this issue still issue exists 

thanks


Related Posts