Chapter 4: Interacting with a page

Thanks to Chapter 3, Navigating through a website, we now know how to open a browser and all the different options we have to launch browsers and create new pages. We also know how to navigate through other pages. We learned about HTTP responses and how they are related to a request.

This chapter is about interaction. Emulating user interaction is essential in UI testing. There is one pattern in unit testing called Arrange-Act-Assert (AAA). This pattern enforces a particular order in the test code:

  • Arrange – Prepare the context.
  • Act – Interact with the page.
  • Assert – Check the page reaction.

In this chapter, we will learn how to find elements on a page. We will understand how the development team can improve ...

Get UI Testing with Puppeteer 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.