Page Object example waiting for an element in the action method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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