The DeletePostPage PageObject deals with deleting an existing post, using the following code:
package com.example;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;import org.openqa.selenium.support.FindBy;public class DeletePostPage { WebDriver driver; @FindBy(linkText = "Move to Trash") WebElement moveToTrash; public DeletePostPage(WebDriver driver) { this.driver = driver; System.out.println(driver.getCurrentUrl()); } public void delete() { moveToTrash.click(); }}
The DeletePostPage PageObject is similar to the AddNewPostPage and EditPostPage PageObjects and is instantiated at the deleteAPost service of the AllPostsPage PageObject. This provides a service, named delete, to delete an ...