Chapter 7. The Page Object Pattern

In this chapter, we will try to better organize the test codebase we created in the previous chapter. In order to do so, you will learn the Page Object pattern. This pattern will allow us to simplify our test code and encapsulate the complexity of using WebDriver and accessing the DOM in a nice object that we can reuse across all of our codebase.

In this chapter, you will learn:

  • What the Page Object pattern is and why to use it
  • Best practices to design a page object
  • How to save code by designing a library of small reusable page objects
  • How to build a page object using WebDriver
  • How to properly test the navigation logic of our application (do not do this in the page object)

Introducing the Page Object pattern

If we have ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.