From the course: Learning Selenium: Structure, Scale, Run, and Optimize Automated Tests
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
What is a page object model (POM)? - Selenium Tutorial
From the course: Learning Selenium: Structure, Scale, Run, and Optimize Automated Tests
What is a page object model (POM)?
- [Instructor] If you're a tester, you must have already heard of this term, POM. POM basically means page object model. It is one of the best practices described on Selenium website. The page object model is a design pattern that helps us write clean and maintainable Selenium tests. It models each page, a part of a page as a class. This keeps the details like locators and actions out of our test logic, so our test focuses only on what they are meant to verify. With POM, when the UI changes, say a field ID changes, you only update your page class, not every test. This keeps your test code clean and focused, and it works well even as your app grows. This is how the page object model works in practice. Instead of repeating locators and actions across every test, imagine a test suite of like thousand tests, we just define a contact page class that handles everything for this form. The locators map directly to the form fields and button, and the class provides clean methods like fillForm…