Rayrun
← Back to videos

#18 - Locating Complex UI Element in Playwright with new locator strategy (ARIA)

In this video, we will discuss how the new Advanced and more flexible Playwright Locator Strategy introduced to identify and locate UI elements in DOM identifies complex controls UI DOM structure and how efficient they are while working with it.

In this video, we explore the new locator strategy in Playwright with C#. We take a look at using ARIA roles and the get by role method to select elements on a page. By using this approach, we can create more readable locators in our test scripts. We go through a practical example by testing the ExecuteAutomation website, which is built using React, a single-page application framework. Observing the generated locators, we notice that the locators are now more readable and closer to the visible text on the screen.

Additionally, we discuss the concept of navigating through parent and child elements when identifying controls on a web page. With ARIA roles in Playwright, this process is more streamlined and intuitive. An example of this is using the 'get by label' method to identify elements by their parent form. This results in more readable and maintainable locators compared to verbose CSS or XPath locators.

In summary, using the new locator strategy in Playwright with C# provides a more sophisticated, readable, and maintainable approach, helping testers create and manage their test scripts more efficiently.

Related Videos

#17 - New Advanced Locator Strategy in Playwright
#17 - New Advanced Locator Strategy in Playwright
#16 - ARIA and how Playwright is making use of it to identify UI controls?
#16 - ARIA and how Playwright is making use of it to identify UI controls?
Playwright Installation - 2022
Playwright Installation - 2022
Save Test Execution In Video | Playwright - Part 5
Save Test Execution In Video | Playwright - Part 5
TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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 luc@ray.run.