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.

Locators input field

Locators input field

In this lesson, we'll learn how to select input fields using the GetBy label and the GetBy placeholder method. Now let's say we would like to select this input field. And if I go ahead and inspect it, you can see it is a input field. And it also has a label that is e-mail address. Now you will find this pattern in almost every input field. is there is an input field that is this text box and with that you will have a corresponding label that is what it is about in this case it is e-mail address so what we can do is find input fields based on their corresponding labels that's what the get by label method does so let's go ahead and try to locate this so we'll say e-mail input page get by label and we'll just go ahead and pass it the label in this case it is e-mail address so we have the element located we can just use the highlight to highlight it out. You can see it is highlighted. Similarly, we can look out for some other input field. Let's say we want to look out for this password…

Contents