Working on an end-to-end example of WordPress
Now that we know what PageObjects are, it's time to take a look at an end-to-end example that interacts and tests the WordPress Admin console. First, we will see all the PageObjects and then the test cases that use them.
Looking at all the PageObjects
Let's first see all the PageObjects that are involved in testing the WordPress Admin console.
The AdminLoginPage PageObject
The AdminLoginPage
PageObject deals with the login page. This object has to be refactored if any changes have been made to the page in the target application, using the following code:
package com.packt.webdriver.chapter9.pageObjects; import org.openqa.selenium.WebDriver; public class AdminLoginPage { WebDriver driver; @FindBy(id = "user_login") WebElement email; @FindBy(id = "user_pass") WebElement password; @FindBy(id = "wp-submit") WebElement submit; public AdminLoginPage(WebDriver driver) { this.driver = driver; driver.get("http://demo-blog.seleniumacademy...