Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Created August 21, 2022 11:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Page Object example waiting for an element in the action method
public class PageObjectExample {
private WebDriver driver;
@FindBy(id = "email")
private WebElement email;
@FindBy(id = "password")
private WebElement password;
@FindBy(name = "next")
private WebElement next;
public PageObjectExample(WebDriver driver) {
PageFactory.initElements(driver, this);
}
public void fillEmail(String email) {
new WebDriverWait(driver, Duration.of(5, ChronoUnit.SECONDS))
.until(ExpectedConditions.visibilityOf(this.email));
this.email.sendKeys(email);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment