Page Object Pattern
Page Object Pattern Page object pattern is a popular design pattern used in selenium webdriver automation. Under this pattern create object oriented class for a page to interact, thus in this way the class written serve as interface to the web page. Within the class write methods for each element to interact The Page Object pattern represents the screens of your web app as a series of objects and encapsulates the features represented by a page.
with the page object we have following advantages
- Test framework will be more readable and code for a page elements will be logically grouped together
- Test framework will be easy to maintain and less redundant code
- If the UI changes for the page, the tests themselves don’t need to change, only the code within the page object needs to change.
- There is clean separation between test code and page specific code such as locators (or their use if you’re using a UI map) and layout.
To continue and sample code
Download example source code Selenium Webdriver Page Object Pattern
External References
http://code.google.com/p/selenium/wiki/PageObjects
http://docs.seleniumhq.org/docs/06_test_design_considerations.jsp
http://assertselenium.com/automation-design-practices/page-object-pattern/