Created
August 29, 2012 08:00
-
-
Save bleathem/3508270 to your computer and use it in GitHub Desktop.
Graphene Login component
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 LoginComponent implements Component { | |
@Root | |
private WebElement driver; | |
@FindBy(id="loginForm:username") | |
private WebElement usernameInput; | |
@FindBy(id="loginForm:password") | |
private WebElement passwordInput; | |
@FindBy(id="loginForm:login") | |
private WebElement loginButton; | |
@Override | |
public void setRoot(WebElement webElement) { | |
driver = webElement; | |
} | |
@Override | |
public WebElement getRoot() { | |
return driver; | |
} | |
public void setUsername(Object username) { | |
usernameInput.sendKeys(username.toString()); | |
} | |
public void setPassword(Object password) { | |
passwordInput.sendKeys(password.toString()); | |
} | |
public void submit() { | |
loginButton.submit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment