Skip to content

Instantly share code, notes, and snippets.

@jimevans
Forked from anonymous/gist:828a4041e88854301e74
Last active August 29, 2015 14:05
Show Gist options
  • Save jimevans/bcc165f4d8fa83a410e8 to your computer and use it in GitHub Desktop.
Save jimevans/bcc165f4d8fa83a410e8 to your computer and use it in GitHub Desktop.
public class SomePage extends CommonPage {
@FindBy(id = "anId")
private WebElement el;
public SomePage(WebDriver driver) {
super(driver);
}
public OtherPage goOtherPage() {
el.click();
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS)
.ignoreAll(NoSuchWindowException.class, NoSuchElementException.class);
wait.until(new Function<WebDriver, Boolean>() {
@Override
public Boolean apply(WebDriver input) {
input.switchTo.window("newWindowName");
return true;
}
});
return new OtherPage(getDriver());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment