Next-Gen App & Browser
Testing Cloud

Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Next-Gen App & Browser Testing Cloud

What is a page object model?

The Page Object Model (POM) is a design pattern popularly used in test automation to create an object repository for web page elements. The advantage of this model is that it reduces code duplication and improves test maintenance.

Under this model, each web page in the application should have a corresponding Page Class. Each Page Class will have methods that identify the WebElements of its corresponding web page and perform operations on those WebElements. The names of these methods should be given as per the action they perform. In other words, if a loader waits for the payment gateway to appear, its method could be waitForPaymentScreenDisplay().

Page Object Model can help us write better and more maintainable tests by preventing our code from becoming brittle and duplicated. It also makes the code more readable and easier to understand.

POM separates the abstraction of a test object from Selenium Java testing scripts by creating a UI object to be automated to wrap HTML elements and encapsulate interactions with the UI, thus allowing for decoupling. This makes it easier to update in case of any element changes since only one class needs to be updated.

Test your website on 3000+ browsers

Get 100 minutes of automation test minutes FREE!!

Test Now...

KaneAI - Testing Assistant

World’s first AI-Native E2E testing agent.

...
ShadowLT Logo

Start your journey with LambdaTest

Get 100 minutes of automation test minutes FREE!!

Signup for free