Skip to content

Instantly share code, notes, and snippets.

@Xotabu4
Created September 1, 2016 19:52
Show Gist options
  • Select an option

  • Save Xotabu4/79ece1d104f2557a70cd079b62f46f45 to your computer and use it in GitHub Desktop.

Select an option

Save Xotabu4/79ece1d104f2557a70cd079b62f46f45 to your computer and use it in GitHub Desktop.
Java page object example
public class SearchPage extends PageObject {
@FindBy(id = "searchString")
WebElement searchField;
@FindBy(css = "button[value='Search']")
WebElement searchButton;
@FindBy(id = "main-box-categories")
WebElement categoriesList;
public SearchPage(WebDriver driver) {
super(driver);
}
public void searchFor(String searchTerms) {
searchField.sendKeys(searchTerms);
searchButton.click();
}
public void selectsCategory(String category) {
categoriesList.findElement(By.LinkText(category)).click();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment