← Selenium Automation Testing learning pathSelenium Automation Testing · Module 7 of 10
Page Object Model
Organise tests with reusable page classes.
📖 Key ideas
- Page Object Model (POM): one class per page with locators and actions.
- Tests call page methods: login_page.login(user, pass).
- Changes to UI need updates in one place.
- Keep assertions in tests, not page objects.
- Page Factory (Java) initialises elements with annotations.
💡 Real-life example: POM is a TV remote: tests press "login" without knowing the wiring inside.
Page Object ModelDesign pattern for UI tests
Page classRepresents one page
Locator encapsulationKeeping locators inside page classes
Page FactoryJava helper for page objects