Counting posts

This test case deals with counting of the number of posts currently available in the blog, using the following code:

@Test public void testCountPost() {    AdminLoginPage loginPage =            PageFactory.initElements(driver, AdminLoginPage.class);    AllPostsPage allPostsPage = loginPage.login(username, password);    Assert.assertEquals(allPostsPage.getAllPostsCount(), 1);}

The following is the sequence of steps executed in the preceding test script to test counting the number of posts in the WordPress blog:

  1. It creates an instance of the AdminLoginPage PageObject that uses the driver instance created in the previous step.
  2. Once it gets the instance of the AdminLoginPage PageObject, it uses the login service to log into the WordPress Admin console. ...

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.