Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disadvantages of Page Object Model in Selenium [closed]

Are there any disadvantages of using page objects for Selenium tests?

like image 700
Neeraj Kumar Avatar asked Nov 01 '14 11:11

Neeraj Kumar


People also ask

What are disadvantages of page object model?

Disadvantages of POMAll locators should be kept in page class file. And this abstraction leads to some chaos within the Page Class file. So you need to implement something like a key word driven on top of Page Object Model so as to fully take the advantages.

What are the advantages of using Page object model?

Advantages of Page Object ModelHelps with easy maintenance: POM is useful when there is a change in a UI element or there is a change in an action. An example would be: a drop-down menu is changed to a radio button. In this case, POM helps to identify the page or screen to be modified.

Which is better page factory or page object model?

What is the difference between Page Object Model (POM) and Page Factory: Page Object is a class that represents a web page and hold the functionality and members. Page Factory is a way to initialize the web elements you want to interact with within the page object when you create an instance of it.


1 Answers

Page Objects Model is best suited for applications which have multiple pages or states. Each of which have fields which can be uniquely referenced with respect to the page.

Advantages:

  1. Object Repository: You can create an Object Repository of the fields segmented page-wise. This as a result provides a Page Repository of the application as well. Each page will be defined as a java class. All the fields in the page will be defined in an interface as members. The class will then implement the interface.

  2. Functional Encapsulation: All possible functionality or operations that can be performed on a page can be defined and contained within the same class created for each page. This allows for clear definition and scope of each page's functionality.

  3. Low maintenance: Any User Interface changes can swiftly be implemented into the interface as well as class.

  4. Programmer Friendly: Robust and more readable. The Object-oriented approach makes the framework programmer friendly.

  5. Low Redundancy: Helps reduce duplication of code. If the architecture is correctly and sufficiently defined, the POM gets more done in less code.

  6. Efficient & Scalable: Faster than other keyword-driven/data-driven approaches where Excel sheets are to be read/written.

Disadvantages

  1. High Setup Time & Effort: Initial effort investment in development of Automation Framework is high. This is the biggest weight of POM in case of web applications with hundreds/thousands of pages. It is highly suggested that if this model is decided to be implemented, then it should be done parallel to development of the application. Refer V-Model for Software Development Life Cycle.

  2. Skilled labor: Testers not technically sound or aware of programming best practices are a nightmare in this case. Perhaps this is the biggest mistake to make, employing unskilled labor in hopes of training them during implementation. Unskilled testers need to undergo a Training Boot Camp to be ready for such an undertaking. Also the Architecture of the framework should be defined clearly and completely before development in order to avoid any loopholes in later stages. Every application is different and it may require the automation framework to be significantly tailored towards it.

  3. Specific: Not a generic model. Automation Framework developed using POM approach is specific to the application. Unlike keyword-driven/data-driven frameworks, it is not a generic framework.

Irrespective of the disadvantages, POM is perhaps the most efficient and highly recommended approach towards any web application. As the framework matures it is perhaps easier to modify it into a hybrid framework from a POM approach than from other keyword/data driven approaches.

like image 138
Zeeshan Siddiqui Avatar answered Oct 08 '22 17:10

Zeeshan Siddiqui