Here, we are using a WordPress blog with the following URL http://pageobjectpattern.wordpress.com/. Let us create three test cases for it before we start talking about the PageObject pattern.
The following test script will log in to the Admin portal of our WordPress blog and add a new blog post:
public class TestAddNewPost { public static void main(String... args) { WebDriver driver = new FirefoxDriver(); // Login to Admin portal driver.get("http://pageobjectpattern.wordpress.com/wp-admin"); WebElement email = driver.findElement(By.id("user_login")); WebElement pwd = driver.findElement(By.id("user_pass")); WebElement submit = driver.findElement(By.id("wp-submit")); email.sendKeys("[email protected]"); pwd.sendKeys("webdriver123"); submit.click(); // Go to AllPosts page driver.get("http://pageobjectpattern...