Locator represents a view of the element(s) on the page. It captures the logic sufficient to retrieve the element at any given moment.
The video is a tutorial on three topics:
straight
and locator
API, and how to use the element handle
to interact with elements on a webpage.nth
function, which allows for interacting with multiple elements on a webpage.locator
API over the element handle
.The video starts with an introduction and then dives into a demonstration of the concepts. The presenter shows how to use the element handle
to interact with buttons on a webpage, and explains that by default, the element handle
interacts with the first element it finds. However, if the same locator is used for multiple elements, it is necessary to use the straight
parameter to either allow or prevent multiple interactions.
Next, the presenter introduces the locator
API, which provides a more advanced way of interacting with elements on a webpage. They explain that the locator
API refines the element each time it is used, which can be useful for scenarios where the elements on a webpage change dynamically. The presenter then demonstrates how to use the locator
API to interact with multiple elements, and provides examples of how to count the number of elements found and how to print the text of each element.
The video concludes by highlighting the recommended usage of the locator
API over the element handle
, and encourages viewers to adopt the new changes in Playwright to enhance their frameworks. The presenter also welcomes feedback from viewers.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].