final Set<String> beforeHandles = fatwire.getWindowHandles();
System.out.println("window before:" +beforeHandles);
Thread.sleep(4000);
fatwire.findElement(By.xpath("//input[@value='Create']")).click();
new WebDriverWait(fatwire, 30){ }.until(
new ExpectedCondition<Boolean>(){
public Boolean apply(WebDriver driver) {
return (driver.getWindowHandles().size() > beforeHandles.size()) ? true :
false;
}});
new WebDriverWait(fatwire,30);
Set<String> afterHandles = fatwire.getWindowHandles();
afterHandles.removeAll(beforeHandles);
String newWindowHandle = afterHandles.iterator().next();
fatwire.switchTo().window(newWindowHandle);
No comments:
Post a Comment