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/ 

To view or add a comment, sign in

More articles by Rohit Omar

  • Restful API automation with Ruby and RSpec

    https://github.com/omarrohit20/api-automation-rest-soap API automation Installation You will need to have Ruby…

  • Test Automation Framework Architecture

    We can specify test framework for automation in following layers Test Cases, Specifications or Behavior Test Cases…

  • WebDriver waits

    Now days most of web application using AJAX heavily. When page loaded in browser web element loaded in different time…

  • Capturing network traffic errors with Selenium automation

    While running test in Continuous Integration (CI) environment we come across to capture network traffic for errors and…

  • Cyclomatic Complexity

    Cyclomatic complexity introduced by thomas McCabe in 1976. It simply measures the amount of decision logic in the…

  • Behavior Driven Development

    Behavior Driven Development Behavior Driven Development is software development practices emerged from Test Driven…

  • Selenium Web Driver, Page-factory and Cucumber

    Selenium Web Driver, Page-factory and Cucumber To continue and sample code

  • Visual Test Automation Selenium WebDriver and ImageMagick

    Validate all visual aspects of web UI like manual tester. This is hard to validate CSS and UI issues across browser…

Explore content categories