Page Object Model (POM)

Selenium Element Locators, Inspecting Elements, Selenium WebDriver API Commands and Writing Selenium Test Cases.
Post Reply
Gowtham Ramesh
Posts: 66
Joined: Thu Nov 22, 2018 5:23 am

Page Object Model (POM)

Post by Gowtham Ramesh » Thu Nov 22, 2018 1:52 pm

What is Page Object Model and use of POM in Selenium Testing?

Posts: 48
Joined: Fri Nov 23, 2018 5:31 am

Re: Page Object Model (POM)

Post by charan » Fri Nov 23, 2018 8:31 am

Page Object Model (POM) is a design pattern in selenium.
A design pattern is a solution or a set of standards that are used for solving commonly occurring software problems.
POM helps to create a framework for maintaining selenium scripts.
In POM for each page of the application a class is created having the web elements belonging to the page and methods handling the events in that page.
The test scripts are maintained in separate files and the methods of the page object files are called from the test scripts file.

advantages :
Using POM we can create an Object Repository, a set of web elements in separate files along with their associated functions. Thereby keeping code clean.
For any change in UI(or web elements) only page object files are required to be updated leaving test files unchanged.
It makes code reusable and maintain able.

Posts: 85
Joined: Thu Jan 03, 2019 3:58 am

Re: Page Object Model (POM)

Post by srini » Fri Jan 04, 2019 10:59 am

Page Object Model (POM) is a popular design pattern to create an Object Repository in which each one of those web elements properties are created using a class file.

=>POM is an implementation where test objects and functions are separated from each other, thereby keeping the code clean.
=>The objects are kept independent of test scripts. An object can be accessed by one or more test scripts, hence POM helps us to create objects once and use them multiple times.
=>Since objects are created once, it is easy to access as well as update a particular property of an object.

Posts: 55
Joined: Thu Jan 03, 2019 3:57 am

Re: Page Object Model (POM)

Post by kishore » Mon Jan 07, 2019 5:13 am

Page Object Model is a design pattern which has become popular in test automation for enhancing test maintenance and reducing code duplication. A page object is an object-oriented class that serves as an interface to a page of your AUT.
The tests then use the methods of this page object class whenever they need to interact with the UI of that page, the benefit is that if the UI changes for the page, the tests themselves don’t need to be changed, only the code within the page object needs to change.
Subsequently all changes to support that new UI are located in one place.
Increasing automation test coverage can result in unmaintainable project structure if locators are not managed in right way. This can happen due to duplication of code or mainly due to duplicated usage of locators.

Advantages of Page Object Model:
1.According to Page Object Model, we should keep our tests and element locators separately, this will keep code clean and easy to understand and maintain.
2.The Page Object approach makes test automation framework programmer friendly, more durable and comprehensive.
3.Another important advantage is our Page Object Repository is Independent of Automation Tests. Keeping separate repository for page objects helps us to use this repository for different purposes with different frameworks like, we are able to integrate this repository with other tools like JUnit/NUnit/PhpUnit as well as with TestNG/Cucumber/etc.
4.Test cases become short and optimized as we are able to reuse page object methods in the POM classes.
5.Any change in UI can easily be implemented, updated and maintained into the Page Objects and Classes.

Posts: 24
Joined: Thu Jan 03, 2019 3:54 am

Re: Page Object Model (POM)

Post by satyanarayanareddy » Mon Jan 07, 2019 10:40 am


Post Reply

Return to “Selenium WebDriver”