In my project i tried to automate Creating a new employee , for that i need to click a link which will open a child window from main window and in that child window i need to click on a lookup button, to select a report manager for that employee . After clicking that lookup im getting a new grandchild window which contains list of managers name, so that i can select one from it.
Following is the code that i have used to move between windows,
// Moving from Parent to Child
String parentWindow = driver.getWindowHandle();
Set<String> windowHandles = driver.getWindowHandles();
System.out.println(windowHandles.size());
windowHandles.remove(parentWindow);
driver.switchTo().window((String) windowHandles.toArray()[0]);
// Click lookup to emulate Grandchild window
driver.findElement(..)
//From child to grandchild
Set<String> grandChild_Child_ParentHandles=driver.getWindowHandles();
grandChild_Child_ParentHandles.remove(parentWindow);
grandChild_Child_ParentHandles.remove(windowHandles);
System.out.println(grandChild_Child_ParentHandles.size());
driver.switchTo().window((String) grandChild_Child_ParentHandles.toArray()[0]);
System.out.println(driver.getTitle());
My code is running till clicking that lookup , after that my code stopped to execute. And the code starts again if and only i closed the Grandchild window manually .I'm wondering why it happening.
Kindly help!
Thanks in Advance, Siva