9.3
PageObjects
の設計の推奨プラクティス
183
@FindBy(how=How.ID, using="post-search-input")
WebElement searchPosts;
@FindBy(how=How.ID, using="cat")
WebElement viewByCategories;
@FindBy(how=How.LINK_TEXT, using="Add New")
WebElement addNewPost;
public AllPostsPage(WebDriver driver){
this.driver = driver;
driver.get("http://pageobjectpattern.wordpress.com/wp-admin/edit.php");
}
public void createANewPost(String title, String description) {
addNewPost.click();
AddNewPost newPost
= PageFactory.initElements(driver, AddNewPost.class);
newPost.addNewPost(title, description);
}
public void editAPost(String title){
}
public void deleteAPost(String postTitle) { ...