Page Object Model (POM) Design Pattern
What Is the Page Object Model?
Page Object Model (POM) is a design pattern where each web page (or component) is represented as a class containing its locators and the actions a user can perform on it, separating page structure from test logic.
Why POM Improves Maintainability
Without POM, locators are scattered across every test file, so a single UI change can require editing dozens of tests. With POM, that same change only requires updating one page object class.
Anatomy of a Page Object
| Part | Purpose |
|---|---|
| Locators | Store element references for that page, defined once |
| Action Methods | Expose high-level actions like login() or addToCart() |
| Verification Methods | Provide reusable ways to check page state or results |
A Simple POM Example Flow
A LoginPage class might expose a login(username, password) method internally handling locating and filling both fields and clicking submit - so tests simply call loginPage.login(user, pass) instead of repeating raw Selenium commands.
With a clean page structure via POM, the next step is making those tests reusable across many inputs through data-driven testing.
Ready to master Selenium Training Course?
Join Uncodemy's hands-on training and build real automation skills with expert mentors.
← Back to Course