When Should You Use Page Object Model?
POM becomes particularly useful when your automation project starts growing.
Consider using POM when:
✅ You have many test cases
If you have only two or three small tests, POM may feel unnecessary.
But when you have dozens or hundreds of tests, maintaining repeated locators becomes harder.
✅ The same page is used by multiple tests
For example, if many tests interact with:
Login Page
Checkout Page
User Profile Page
creating page objects can help centralize the common interactions.
✅ Locators are repeated
If the same locator appears across multiple test files, it may be a good candidate for a page object.
✅ Your application is large
For applications with many modules and workflows, POM can provide a clear structure.
For example:
pages/
LoginPage.ts
DashboardPage.ts
UserPage.ts
ProductPage.ts
CartPage.ts
PaymentPage.ts
✅ Multiple QA engineers are working on the framework
A consistent structure becomes more valuable when several people contribute to the automation project.
When Should You NOT Use POM?
POM is useful, but it doesn’t mean you must use it for every single test.
For a very small automation project, creating many classes can add unnecessary complexity.
For example, if you have one simple test:
test('Open homepage', async ({ page }) => {
await page.goto('https://example.com');
});
Creating a separate page object just for this may not provide much value.
The goal is not:
“Use POM everywhere.”
The goal is:
“Use POM where it makes the automation easier to maintain.”