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.

Assertions input field

Assertions input field

In this lesson, we'll learn how to expect the different states of an input field and its properties. We'll use the input field which comes after we click on the search box, which is the search docs input field. So let's go ahead and inspect the same. Now you will see it has a label, but the label does not have any text inside of it. So we have to look for another way to locate the same. And fortunately, we have the placeholder inside of the input. So let's use the same. So create an input page get by placeholder. And the placeholder is search docs. The first step is to make sure that the input is hidden before button click. So to do that, we can simply expect the input to be hidden. Now the input field only becomes visible when we click on this search button. Now it may look like the input field in itself, but it is just a button. So let's go ahead and now inspect the same. You will see this is a button element with a span of search. So let's go ahead and locate the same using its…

Contents