O'Reilly logo

Learning Behavior-driven Development with JavaScript by Enrique Amodeo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required