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.

Custom waiting

Custom waiting

In the previous lesson we learned about the different states which we can wait until when we do navigations and in this lesson we'll learn how can we wait for elements or any other locator with the wait for method that is the custom wait. So let's say what we want to do is visit a website like this. It has some ears which we can choose to view the movies which won Oscar for that. Now you can see that when I click on this button or any other you can see there's a loader and then we get the data. Now this is not related to the navigation at all. So here we need our custom weighting. So let's go ahead and simulate what we're going to do. So first of all, we will be in the home page, that is this right here. And I'll go ahead and remove the wait until go to the base page. And then we will go ahead and click on any of these links. So let's say this one right here, and you can see it is a tag, its role is a link, and it has 2015 text. So let's select it based on that. So the link is page…

Contents