Skip to content

PageObject pattern

vladlion77 edited this page Jan 8, 2015 · 4 revisions

The Page Object pattern represents the screens of your web app as a series of objects.

This is an extremely useful design pattern for UI tests as it abstracts away how we get to different pages or screens. The Page Object design helps us create a DSL for our tests. This means that if we are to change something on the page, we don’t need to change the test, but simply update the object that represents the page.


  • The public methods represent the services that the page offers
  • Try not to expose the internals of the page
  • Generally don’t make assertions
  • Methods return other PageObjects
  • Need not represent an entire page
  • Different results for the same action are modelled as different methods