Let's take goToTheAboutPage() as an example. We have refactored it to make it nice and clear, but we now want to abstract things away into a page object to encourage other people to use all that hard work finding the correct locators. Let's create two page objects called IndexPage and AboutPage and move our element definitions across into them. We will start off with the index page:
package com.masteringselenium.page_objects;
import org.openqa.selenium.By;
public class IndexPage {
public static By heading = By.cssSelector("h1");
public static By mainText = By.cssSelector(".col-md-4 > p");
public static By button = By.cssSelector(".btn");
public static By aboutLinkLocator =
By.cssSelector(".left-footer > a");
}
Then, we need to create the page object for the...