I'm trying to switch to a new window that will open when i did the login in the previous page, After clicking the login button a new tab will be opened and gets closed immediately then a new window will be opened, this window handle is not recognizing by selenium IE driver in IE MODE but I'm able to switch to this new window while automating in normal internet explorer browser. The code that I'd tried to switch to that new windows is as shown below.
Thread.sleep(3000); // This delay is to avoid the new tab that gets closed immediately without this delay the driver is trying to switch to that new tab, after that any operation leads to throwing no browser exception. So this line is saving from the issue.
String desiredTitle = "";
while(!desiredTitle.contains("new window")) {
for (String ewh : driver.getWindowHandles()) {
desiredTitle = driver.switchTo().window(ewh).getTitle();
}
}