Thursday 3 October 2013

Window Handlers to switch to new window and close

String currentHandle = driver.getWindowHandle(); 
Set<String> handles = driver.getWindowHandles(); 
handles.remove(currentHandle); 
if (handles.size() > 0) 
driver.switchTo().window(handles.iterator().next()); 
System.out.println(driver.getTitle());
driver.close();
driver.switchTo().window(currentHandle); 
waitForPageToLoad(driver);

No comments:

Post a Comment

Angular JS Protractor Installation process - Tutorial Part 1

                     Protractor, formally known as E2E testing framework, is an open source functional automation framework designed spe...