Skip to content

Instantly share code, notes, and snippets.

@bleathem
Created August 29, 2012 08:00
Show Gist options
  • Save bleathem/3508270 to your computer and use it in GitHub Desktop.
Save bleathem/3508270 to your computer and use it in GitHub Desktop.
Graphene Login component
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