Created
September 1, 2016 19:52
-
-
Save Xotabu4/79ece1d104f2557a70cd079b62f46f45 to your computer and use it in GitHub Desktop.
Java page object example
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 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