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.

Summary

  • 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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.