Winium example with word automation

I have been exploring the new tools for windows based apps automation, having worked on white API and its lack of documentation and complexity in writing the code, i was searching for good alternative.

Winium seems to be one of the options suggested by selenium group of people, as the syntax is similar to selenium.

Winium uses the winium.desktop.driver to start off the listening of the commands sent by the driver and redirect them to the application under test. There are several dependencies that are required just as selenium web driver for the desktop driver.

The basics need to work on WInium is

  1. Winium.desktop.driver.exe (winium.driver.exe)
  2. Eclipse with maven plugin
  3. Inspect tool  / .Net framework with windows tool kit
  4. Selenium background

Eclips with maven plugin : This is required since there are dependencies that are required to work with Winium, with maven plugin and with the POM file we can download all the plugins.  the POM file is given below for the dependencies.

<project xmls="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>WiniumTests</groupId>
<artifactId>WiniumTests</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.github.2gis.winium</groupId>
<artifactId>winium-webdriver</artifactId>
<version>0.1.0-1</version>
</dependency>
</dependencies>
</project>

Once you have created the project and updated the project with dependencies. You can create a test case and will be able to use the sample code below.

Just like chrome driver options we can initiate the desktop driver with options.

DesktopOptions option = new DesktopOptions();
option.setApplicationPath("C:\\Program Files\\Microsoft Office\\root\\Office16\\WINWORD.EXE");

First line is to create the options object for the desktop driver.

After creation of the object, set the application under test executable path. In the above case it is windows word.

Let us look at how do we identify the windows objects. In case of web elements we can use firebug, firepath or developer mode in browsers to get required css or xpaths.

In the windows based apps, there is tool called Inspect.exe which will be located in below path.

C:\Program Files (x86)\Windows Kits\8.1\bin\x86\Inspect.exe

Or you can search for it in entire computer, just in case of you don’t find it.

2. Inspect tool : This tool is similar to developer tools of browser. It can tell us the windows object properties. We can make use of some of the properties like classname, name, automation id etc to identify and perform operations on those objects.

InspectScreenshot

In the current context we are trying to do word automation, so to go to insert tab, we can use find element by name of it, as you see the properties description it says name is ‘Insert’

Similarly we can identify the object based on their names. Following is the code for the identification of some of the basic word GUI objects.

//Selects the blank document
driver.findElement(By.name("Blank document")).click();
//Goes to insert tab
driver.findElement(By.name("Insert")).click();
//Clicks on shapes
driver.findElement(By.name("Shapes")).click();
//Selects the rectangle
driver.findElement(By.name("Rectangle")).click();
//Clicks on rectangle to get it on the word.
driver.findElement(By.name("Page 1")).click();

The entire code is below.

package com.tests;

import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.winium.DesktopOptions;
import org.openqa.selenium.winium.WiniumDriver;

public class Tests 
{

@Test
public void CalcTest() throws MalformedURLException, InterruptedException
{

DesktopOptions option = new DesktopOptions();
option.setApplicationPath("C:\\Program Files\\Microsoft Office\\root\\Office16\\WINWORD.EXE");

WiniumDriver driver = new WiniumDriver(new URL("http://localhost:9999"), option);
//SLeep is to wait until the word becomes visible
Thread.sleep(5000);
driver.findElement(By.name("Blank document")).click();
driver.findElement(By.name("Insert")).click();
driver.findElement(By.name("Shapes")).click();
driver.findElement(By.name("Rectangle")).click();
driver.findElement(By.name("Page 1")).click();
driver.quit();
}

}

Entire code is given in the below git repo.

Winium_Example

Before we execute any of the test cases, we need to start the winium driver exe as it is the listener to the events provided by the driver. Also, check the port on which it is running , use the same port while creating the driver.

Following is the demo.

 

Thank you. Please write in comments in case you need more information on winium automation.

Advertisement

TestNG Annotations list and execution order

TestNG is testing framework enhancing the Junit framework.

Lets look at different annotations it provides for the test execution stand point.

Following is the list of all annotations that one may require to control after or before facts of test execution. These methods will execute before or after the event is called. These annotations does not depend on the test execution status.

@BeforeSuite
@AfterSuite
@BeforeTest
@AfterTest
@BeforeGroups
@AfterGroups
@BeforeClass
@AfterClass
@BeforeMethod
@AfterMethod

the sample test class with annotations produces following output. All the other annotations does not need any parameters except that before and after group annotation, following is how we can mention the group name.

@BeforeGroups("Sanity")
	public void beforeGroups() {
		System.out.println("Calling before groups");
	}

Output from java console :

Consoleoutput

While doing console logs, I have struggled to get rid off other console messages produced by the chrome driver. Following piece of code is used to suppress the console logs produced by chrome driver, added this just thought might be relevant to share.

System.setProperty("webdriver.chrome.driver", ChromeDriverPath);
System.setProperty("webdriver.chrome.silentOutput", "true");

 

 

 

 

Synchronizing web driver and Ignoring Exceptions in C# Selenium API

In general the website response times may cause issues while doing the UI automation testing. Most of the times test scripts will fail due to synchronizations issues from web-driver and the application web elements.

Following are the common reasons and if we see very frequent issues in synchronization it is suggested to do performance testing and tuning.

  • Location from where we are accessing the application (Latency)
  • Network bandwidth
  • Too much firewall checks
  • Website architecture and technology on which website built on.

Most of these cases are taken care while doing performance tuning and performance engineering, but yet we see page load issues, element enabling issues and visibility issues while doing UI automation.

In selenium we have several methods that we can use to make sure that these things are taken care. Following is the just enough explanation about waits in Selenium driver.

Implicit waits will wait until the defined action (example page loading ) is complete.

Example of it is managed time outs, and they are defined at driver level.

Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
Driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30);

When we want to wait explicitly at certain number of seconds we will use explicit waits. As the name suggests the test execution will be halted during this time. Example of it is sleep

 Thread.Sleep(2000);

here the parameter indicates the number of milliseconds to wait for.

The other case of waiting for dynamic web elements is using wait until or web driver waits. These are most common implicit waits that are used. There are two ways we can use these.

We can declare the web driver wait and and it will wait for max wait in this case it is 30 seconds, and repeatedly we can check for the expected conditions i this case we are looking for visibility of the element google search text box.

IWebElement textbox;
WebDriverWait waits = new WebDriverWait(Driver, TimeSpan.FromSeconds(30));
textbox = waits.Until(SeleniumExtras
.WaitHelpers
.ExpectedConditions
.ElementIsVisible((By.Name(SEARCH_TEXT_BOX_NAME))));

There is another way we can use this as function delegate, following is how it is used.

//there is another way using function delegate
//delegate parameters and return value = new delegate parameters return value of passed parameters
//delegate is on the fly function generator
Func<IWebDriver,IWebElement>checkForvisibilityOfWebElement = new Func<IWebDriver, IWebElement>((IWebDriver Driver) =>
  {
     IWebElement textBoxDelegate = Driver.FindElement(By.Name(SEARCH_TEXT_BOX_NAME));
       if (textBoxDelegate.Displayed)
           return textBoxDelegate;
       else
          return null;
   }); 
 
 textbox = waits.Until(checkForvisibilityOfWebElement);

When you look at above code, its function delegate takes one argument as IWebDriver and returns the IWebElement. The last argument of function delegate is always a return type.

The wait until function will take this and checks for the condition mentioned in the delegate periodically.

If you look at the until you can clearly see this text.

WaitUntill

But if we look closely, the description says it will throw exception if it is not listed in the Ignore Exception list.

For that purpose. We have to configure our waits object what exceptions that we want to ignore while we periodically check for our condition. We can achieve this by following.

IWebElement textbox;
WebDriverWait waits = new WebDriverWait(Driver, TimeSpan.FromSeconds(30));

waits.IgnoreExceptionTypes(typeof(NoSuchElementException));
waits.IgnoreExceptionTypes(typeof(ElementNotSelectableException));

There are list of exceptions that we may want to ignore, following is the snap shot.

ExceptionList

And finally following is the list of element states we can wait for.

ListOfwaitsfor

Please comment if you see anything is incorrect or you want to add something you know. Thank you.

 

Design Selenium Framework with C# – Part 5

Now since we have created the basic framework and page classes. Lets look at NUnit framework to create tests.

NUnit 3.0 supports parallel testing, and prior to that it supports the testing multiple iterations with different parameters.

Here if you see TestFixture attribute allows the test class to take the constructor parameter. I.E parameters you are defining in the testfixture will be passed to constructor of the test class if matching definition is found. This is very useful when we need to execute same tests with different browsers, we can define BrowserType to achieve the same purpose. The test class will be initiated and tests will be executed for each of those test fixtures.

Also Prallalizable (ParllelScope.Self) will run the test methods in parallel. More information can be found in below link.  Nunit documentation

If you look at the below code, constructor of the test class has browsertype as parameter which is matching with the parameter defined the test fixture. So the test class will run for each browser type.

NUnitTestFixure

And the SetUp attribute is similar to TestSetup in MSTest framework or BeforeTest in TestNG. This will sets up the preconditions for each test.

If you look at the test execution flow

  • Starts at calling DriverFactory.InitDriver(browserType)
  • This will invoke and create corresponding BrowserDriver class object
  • Driver property will be set in the DriverFactory Class with the type of the driver
  • Using the DriverFactory.GetDriver() method we are getting driver to the thread which has initiated it.
  • It will be passed to the Page Classes to do the rest of the test flow.DriverGet

If you look at the test explorer it identifies the tests based on the TestFixture types.

TestExplorer

When you click on run it will run all tests in parallel. You can see the results in the test explorer for each iteration Results

IterationResults

This is the simplest explanation I could give quickly for the Selenium with C# implementation with interface design pattern.

I have not touched any Reporting/Logging part for the framework.

As It can be implemented with ILogger interface with different logging methods so that each logging type (Excel logging, Text, Word/pdf, html) can be implemented easily.

Having said this, it will conclude our discussion on creating the framework.

Please feel free to follow and write to me if you need help in understanding any of these items.

Design Selenium Framework with C# – Part 2

After learning the basics of the interface design pattern, lets look at actual implementation in step by step manner.

Lets first discuss about how to set up the required nuget packages for the selenium.

Open visual studio and create a unit test project by selecting the project type unit testing.

Once the project is created, lets install the required Nuget packages. This Nuget package is similar to maven repository in Java. It contains all binaries required for the purpose.

NuGet

We will download and map to the current project just enough to create some simple selenium tests.

The Nuget packages can be downloaded from different sources, lets download packages from default location https://www.nuget.org/

We need following packages for the purpose of creating the selenium tests.

Nuget required packages for selenium

Once we download and attach it to the project we need to do download another set of install-able files meaning that driver exes to steer the web browsers.

  • IEDriverServer
  • ChromeDriver
  • geckodriver (firefox dirver)

Now our project setup is ready for creating the Framework and implementing the simple selenium tests.

Before we dive into creating classes, lets create folder structure so that we can partition our classes into different directories like below. Will discuss one by one while we go through each of the items. Lets create following folders in the solution.

  • DriverExecutables
    • This will contain the driver executable files we have downloaded
  • IDrivers
    • Contract definitions for creating the WebDrivers
  • WebTesting
    • Actual web driver classes implementing the IDrivers interface.

FolderStructure

As we mentioned in the part one, let us first create the IDrivers interface to make browser object as described below.

IDrivers Interface

In the above Interface, we are defining the objects required fro web driver creation and also using the ‘Driver’ property we are setting and getting the driver back from each implementation.

In this step lets create the configuration class which defines the driver executable locations, timeouts and other browser configuration details we have just defined in the interface.

Configuration

Lets look at each of the web driver class, how it is done. I have kept all the code in git repository for reference.

Lets create filepath property to set and get the file path. Also see how we can set the driver services and desired capabilities/options as class properties.

After creating these properties, next step is to initialize the driver with these options

chrome driver implementation 1

If you look at  below code the folder path is set by config driver exe folder whereas DesiredServices and DesiredCapabilites/Options properties in config class are set by chrome driver class.

chrome driver implementation 2

I will try to explain the logical flow once we complete the entire post.

As of now the summary is, all driver classes (ChromeDriver, FireFox driver class, and IEdriver class)  have all the three methods.

driver classes

The link to the whole repository from git is given below for reference.

selenium framework git repository

It will be much more straight forward if you already well versed with the basic idea of properties, methods, and oops concepts.

Now lets discuss about how to create these browser instances as separate threads so that we can run tests in parallel in next part.

Design Selenium Framework with C# – Part 3

Design Selenium Framework with C# – Part 4

In this part lets look at creating the page objects in most generic way.

As discussed in the last post the selenium support of page object initiation is getting deprecated from next releases of the selenium. So lets create page objects in most generic format.

HomePage

In the above class, we are declaring the all const string or identification strings may be xpath or ids or css selectors as const strings.

And we are assuming that driver object is being sent to the class. We are creating class property as driver and assigning the sent driver while creating the page class object from test.  So the constructor of the page class takes one parameter driver, also if you look at it it take parameter type IWebDriver that means, any type of driver which implements IWebDriver is good enough, this will make class independent of the driver type.

HomePage2

In the above code we have created the web elements as properties of the class

And the actions as methods. We can create the elements in the methods as well. But to make differentiation between actions and elements, its good practice to keep the elements as properties.

I am not creating utility class as of now to keep the common methods in there, also there is no BasePage which has global objects of the application. We can very well do that, but for the simplicity , I have not added additional classes which makes it bit complex to understand the execution flow.

Similar to the above the class, we can create search results page and validation of the search results page in another class called GoogleSearchResults.

SearchResultsPage

And verification method for verifying the returned search result.

SearchResults2

Now that we have every thing ready we are good to create NUnit test and understand the execution flow. I will discuss it in next section.

Design Selenium Framework with C# – Part 5

 

 

Design Selenium Framework with C# – Part 1

In the current Selenium space there are lot of developments are happening. One of the most asked questions in the internet is how to design extensible and most easy frame work that can be suited for different kinds of testing platforms such as desktop, mobile.

Selenium with C# is not that common in the current freeware market era. But its worth knowing about how it can be implemented so that we can future ready. C# is now becoming language for building all kinds of apps including mobile. Having knowledge on C# selenium will bring us more opportunities for a devops engineer.

With that preface, I will try to create a logical flow of learning. Lets look at following areas one by one to achieve our goal of learning.

I typically go with bare minimum requirements to create the framework assuming readers know the basics of any object oriented programming language. So I am starting with concepts familiar but implemented little different in C#.

  • Basics of C# interfaces and setters and getters.
  • Basics of Interface design pattern for framework creation.
  • MS visual studio nuget packages required and drivers required for selenium
  • Driver factory or thread safe driver creation
  • NUnit testing framework bare minimum to Create basic google search test with Nunit

In this blog lets start with first section.

C# provides the important feature of setting and getting the class properties. There are auto properties which are really useful and takes care of the coding.

Setters sets the properties and getter will get you the properties. Following is the example of setters and getters. This is widely used and need to be understood while working with C#

public class test
{
private string _anyproperty;
public string AnyProperty
{
get{return _anyproperty;}
set{ _anyproperty = value;}
}
}

In the above example we can declare private variable and use it to assign and return. This is same as setting auto properties like below in C#.

public class test
{
public string AnyProperty
{
get;set;
}
}

Class properties can be set inside class or out side the class using the class object.
The properties are quite useful in designing the framework. Usually anything we want to set for the entire class such as file path for the excel operations class, file path for the browser driver class etc, this same path can be used in the class methods.

In the next section we will see how interfaces can be used to create portable and readable code.

Interface is generally known as contract agreement. It signs the contract with implementing classes. I.E it enforces the method definitions for implementing class.

The underlying code can differ with different class implementations.

In view of our selenium, let’s take the example of Browser driver, the IWebDriver interface holds the method definitions and all driver classes such as ChromeDriver, FireFoxDriver , IEDriver classes implements the methods in IWebDriver interface.

To understand how we can make use of interfaces to create clean code while designing the C# frame work, lets look at browser object creation.

In C# selenium browser object can be initialized similar to Java. To initialize browser object we need two objects

  • Browser Service
  • Browser Options or Capabilities.
    • IWebDriver ChromeDriver = new ChromeDriver ((ChromeDriverService)service, (ChromeOpions)capabilities, timeout)
    • IWebDriver FireFoxDriver = new FireFox ((FireFoxDriverService)service, (FireFoxOpions)capabilities, timeout)
    • IWebDriver InternetExplorerDriver = new InternetExplorerDriver((InternetExplorerDriverService)service, (InternetExplorerOptions)options, timeout)

If we look at all three initialization, in fact all driver classes implementing IWebDriver have these three parameters two of which are class objects.

It makes sense for us to utilize the interface concept here and create IDriver interface which have two methods (Service object creation and capabilities/option object creation)

This will enforce for all types of driver objects to implement these methods.

Lets end the first part here, and in the next part, will dive deep and create framework using MS visual studio.

Design Selenium Framework with C# – Part 2

 

Design Selenium Framework with C# – Part 3

In this section lets look at creating thread safe driver factory and how we can use it in the tests.

As we have seen in part 2, we have created driver classes and each class is having initDriver method which will creates the driver.

Now lets start with an enum with browser types, and in the driverfactory class which we are going create uses the browsertype enum and creates and stores the corresponding driver.

enum

And lets create thread safe object  using ThreadLocal class, thread local class stores the object initiated by the execution thread, so that when we want to use it we can retrieve it. Think of it as a thread id and driver object pair, each driver object has its thread id attached to it and based on the execution thread, ThreadLocal class will provide the corresponding Driver object.

DriverFactory

If you look at the second method, the GetDriver<DriverType> is generic method with DriverType as generic type of the webdriver.

Since we have declared the ThreadLocal type as ‘Object’ instead of standard class, it will not result in any cast errors.

In the init method based in the browser type we can create the browser object.

init

Here if you observe, the DriverStored property is being set in the InitDriver method.

And the DriverStored object is returned using GetDriver<BroweserType> generic method.

Now we have everything ready, and lets create a simple test and look at the where we are going start our driver initiation and how will we set the flow.

For now lets imagine, all page classes contain UI object creation and action methods.

(In the latest selenium 3.14 creating page objects using findsby is getting deprecated, so I am using POM concept but using it as more generic approach rather than using the regular init elements.)

Design Selenium Framework with C# – Part 4

 

Extent report logging while parallel testing

Hi As we discussed in the last post Parallel testing and Thread Safe driver for testNG, lets discuss about extent report log synchronization.

We can achieve this by invoking parallel threads for each of the test.  Lets consider we have one html extent report and we want to add several tests together.

We can do extent report as static and we can create tests in different threads,  and at the end we can flush each thread to report. Lets see below code for extReport and extTest classes which does the same.

public class ExtReport {
public static Calendar cal = Calendar.getInstance(TimeZone .getTimeZone("GMT")); 
public static long time = cal.getTimeInMillis();   
    public synchronized static ExtentReports getReport() 
    {          
      ExtentReports Report = ( new ExtentReports(System.getProperty("user.dir")    + "/test-output/ExtentReport_" + time + ".html", true));    
      Report.addSystemInfo("Host Name", "TestMachine") 
         .addSystemInfo("Environment", "Automation Testing")
         .addSystemInfo("User Name", "Tester");
      Report.loadConfig(new File(System.getProperty("user.dir")    + "\\extent-config.xml"));     
      return Report;   
    }                
 }

In the above class we are generating static report and have one method to get the report.

This method, will return the static report object. Lets look at creating test and adding it to the same report.

public class ExtTest 
{
public class ExtTest
{
   private static ExtentReports extent = ExtReport.getReport(); 
   public static ThreadLocal<ExtentTest>  extentTestThreadSafe = new ThreadLocal<ExtentTest>(); 
   public static synchronized ExtentTest getTest() 
{ 
  return extentTestThreadSafe.get(); 
}
public static void setTest(ExtentTest tst) 
{ 
   extentTestThreadSafe.set(tst); 
}

In the above class we are creating methods to set and get thread safe version of ExtentTest and use the same test in logging all the actions. Lets look at below code how we can make use of above two classes and do the reporting.

We initiate the logger (extent test) from test method and use setTest and getTest methods to set and access the started ExtentTest.

//this is to get the extent report created and declared in test class
public ExtentReports extent = ExtReport.getReport();
@Test 
public void login_Test_Case_01() 
{ 
try 
{ 
 ExtentTest test = extent.startTest(SheetName); 
 st = new start(); 
 ExtTest.setTest(test); 
//your testing code here you can pass the test to other page classes etc.
 } catch (Exception e) 
{ 
  ExtTest.getTest().log(LogStatus.FAIL, "unexpected error " + e.getStackTrace().toString()); e.printStackTrace(); 
} finally
{ 
extent.endTest(test);
 extent.flush(); 
} 
}

This way tests that are running parallel can write in parallel to the Extent-report.

Here also, there is one challenge that these tests can flush to report when ever they are done/complete/fail. so the final report might not contain tests in any particular order., but all the steps in each test will not jumble up and you see report steps for each test will be listed in the same test. Below is the example report running tests in parallel.

Please find the whole code in below git repo.

https://github.com/SaiAuditya/Selenium_POM.git

Page Object Model – Framework

Most of the times, many project demands start of best fit automation framework from scratch. Page Object Model (POM) is most popular design pattern for the Selenium automation.

In this post, lets try to figure out the details. Before diving in its better to look at this post to get insight of what we are talking here.

Page Object Model – Approach

Lets us look at the following different packages for the purpose of the understanding.

pages contains the test pages for the site, where as each page contains the objects corresponding to that page.

In any UI testing we typically do two things with objects, either we retrieve properties for it or we perform actions on it.

eclipsstructure

In the start section we write necessary code to start the browser. Driver session creation, extent test creation, logger creation etc.

The tests section contains the test classes we are intended to write.

The utilities section contains the common actions class and the reusable action classes.

expandedpackages

Also, its better use config properties for the entire test setup along with the test data sheets. Also maintain drivers in different folder for better readability.

projectStructure

As shown above utilities package contains the excel manipulations such as get and set data operations.

Lets deep dive into start class and what it is doing.

Start class has all declarations and webdriver creation depending the config settings.

Create config file with browser type and other details so that we can use them in the code.

config

Start class will have the entire code for reading the config file and depending on the browser type mentioned in the config it creates the web driver session.

If we look at the declarations, the entire project is using extent reports as it will generate beautiful reports for the test execution.

Also, all other variables are declared as static where as driver is non static. The report logger is also static, since once we create start instance driver will be recreated but not the report logger. This will help to run the same test in multiple iterations keeping the same report.

If we look at the declarations, we are declaring the xldriver, extent report and logger properties as static as they dont need to be re initialized for loop execution. (Static variables are created once, they are not recreated for each instance of class)

start2

the launch_browser method returns the pagefactory object with created driver. This will flow to subsequent pages.

return.PNG

Will see why it is returning the page factory object.

If we look at the pagefactory class, it has definitions of all pages.

We are using pagefactory constructor to send the driver to all the sub subsequent classes.

And, the home and other pages will inherit this class so that they can get the latest driver created by the start class.

pagefactory

Each page class is contains the deification of elements and initialization of elements.

We will use PageFactory class (Selenium specific class) along with ajaxelemetlocator since it has advantage of creating element only when it is being used, we can also define the time duration for the locating element. We are also using reference class object for the common functions.

The reference, and the home class gets the driver created in the start class.

home1.PNG

Also the each class in the page returns the same page for better creation of tests.

home2

And finally coming to writing test cases.

Starting with method name, we are using the data sheet name as test method name.

So to avoid hard coding of the methodname passing to excel setExcelSheet method , we are programatically getting method name and assigning it.

Since xldriver and set_logger method is static, we dont have create start class object to use them.

And looking at the loop, we are getting rows in the excel sheet and running the required actions for each row. That means creating driver doing all actions and logging out.

We can restrict this for certain actions if we dont want to quit the browser, by keeping the creating of start object outside the for loop.

And by keeping (.) at the launch_browser(), we get access to the methods in pagefactory class, and since all other classes are extending pagefactory class, all of them gets access to pagefactory class methods. Thats the reason for writing page navigation methods in the pagefactory class.

This way we can write single line test cases, this will ease the reading of test case and writing and debugging them.

TestCase

the output for the test looks like below.

reports

This is gist of implement page object model with one sample testcase.

In this post we have not included the excel data manulations, hash maps and extent report creation.

We will try to address them in subseqnet posts.

Thank you.