In this article we will discuss how to implement page object model in Playwright. POM is the most widely used design pattern in test automation.
Contents :
· What is POM?
· Why do we need POM?
· Implementing POM in Playwright
What is POM?
POM — Page Object Model is a helper class created for every page in web application which will hold all the located elements as properties and its interactions as methods.
It is a design pattern can be used with any kind of framework like keyword-driven, Data-driven, hybrid framework, etc. The Page object is an object-oriented class which acts as an interface for the page of your Application under test. Page class contains web elements and methods to interact with web elements. While Automating the test cases, we create the object of these Page Classes and interact with web elements by calling the methods of these classes.
Why do we need POM?
In web application test automation, based on scenarios in every test case we need to locate elements and interact with them.
A page object represents a part of your web application. An e-commerce web application might have a home page, a listings page and a checkout page. Each of them can…