The DeletePostPage PageObject

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 existing post. As you can see, the AddNewPostPage, EditPostPage, and DeletePostPage PageObjects take you to the same page. So, it makes sense to merge these three PageObjects into one that provides services for adding, editing, and deleting posts.                                                                              

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.188.64