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 ...

Get Selenium WebDriver 3 Practical Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.