Hasty Briefsbeta

Page Object (2013)

4 days ago
  • #encapsulation
  • #page-object
  • #testing
  • Page objects encapsulate HTML pages or fragments with an application-specific API to avoid brittle tests.
  • They should allow software clients to interact with the UI as a human would, hiding underlying widget details.
  • Page objects should model significant elements on a page, not necessarily one per page.
  • Navigation should return another page object, though some prefer tests to control page object creation.
  • Debate exists on whether page objects should include assertions or just provide data for test scripts.
  • Page objects can encapsulate concurrency issues and async operations.
  • They are commonly used in testing but can also provide a scripting interface for applications.
  • Using a Domain-Specific Language (DSL) over page objects is recommended for tests.
  • Page objects exemplify encapsulation, hiding UI details and making test code cleaner.
  • The term 'page object' was popularized by Selenium, despite initial naming concerns.