From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Playwright homepage POM

Playwright homepage POM

In this lesson, we'll create a page object model for our playwright website. Now what we have been doing so far that is visiting the documentation, we'll go ahead and add that functionality to that page object. And then we can add another one that is searching for an query. So we can create a method search and provide it a query. It will go ahead and launch this search menu and provide the query here. Let's say accept or expect whatever the query is. And then we can go ahead and expect that query to be inside of these suggestions. So let's go ahead and build the same. We'll start with a new model and I'll go ahead and name it something like, let's say, playwright underscore page. can go ahead and start with our class definition but before that i'll just import the page object so that we can hint on the type now we can start with class definition that is playwright page now we can go ahead and define the init and we will receive the page and on its type now i can go ahead and start the…

Contents