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.

POM usage

POM usage

In the previous lesson, we defined our page object model, and we can use the same to test the documentation link and the search functionality. So let's go ahead and open the test module. Here, I have two functions that is test the docs link and test the documentation search. So first of all, we'll define the docs link. And before that, we need to import the model that is from models, playwright page, import the playwright page. I can go ahead and instantiate the same playwright page equals the playwright page and give it the page fixture. I can go ahead and rename it to something like, let's say homepage so that it's short it is actually the homepage of playwright. Now we can go ahead and test the docs link by just using home page, visit the documentations like this. Next, we can go ahead and expect the homepage dot page to have URL that is the documentations link. So go ahead and add it in the new line perfect now our first test function is ready the second function is to search the…

Contents