Created
February 5, 2020 19:14
-
-
Save brobles82/a79489502ad4bbc4fe518855ee3ff86e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 LoginPage { | |
private final WebDriver webDriver; | |
@FindBy(linkText = "Log in") | |
private WebElement login; | |
@FindBy(id = "username") | |
private WebElement usernameInput; | |
@FindBy(id = "password") | |
private WebElement passwordInput; | |
public LoginPage(WebDriver webDriver) { | |
this.webDriver = webDriver; | |
PageFactory.initElements(webDriver, this); | |
} | |
public LoginPage logIn(String username, String password) { | |
usernameInput.sendKeys(username); | |
passwordInput.sendKeys(password); | |
login.click(); | |
return new LoginPage(webDriver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment