Selenium WebDriver- hungs or stucks while switching back from child window to parent window. If I change the specific page in parent window Manually on debug mode,Successfully switch is happening from child to parent window. Guessing that specific page in parent window blocks switching of windows as it expects child window to be closed.How can i overcome this Issue?(To bring back control to parent window for further validation)(Also Suggest if any alternative methods are available to switch windows)
Code:(Used Right Code)
String parentWin = browser.getWindowHandle();
Set<String> handles = browser.getWindowHandles();
String winHandle = null;
Iterator<String> itr = handles.iterator();while(itr.hasNext())
{
winHandle = itr.next();
if (!winHandle.equals(parentWin)) {
browser.switchTo().window(winHandle); //Tried Giving Enough delay also
browser.switchTo().window(parentWin);// It hungs here (Executes at
// the case if change the
// specific page in parent
// window)
}
}