Sure, you can use regex in @playwright/test to find all list items that start with 'You have not viewed this project...'. Here's how you can do it:
First, use the getByRole
method to select all list items (<li>
) on the page.
await page.getByRole('listitem')
Next, apply a filter using the hasText
option and provide a regex pattern.
.filter({ hasText: /^you have not viewed this project/i })
This regex pattern /^you have not viewed this project/i
is case-insensitive and matches any text starting with 'you have not viewed this project'.
By using this approach, you'll find all list items that start with 'You have not viewed this project...'.
Remember, @playwright/test is a powerful tool for web testing. You can learn more about it in this comprehensive guide.
If you still have questions, please ask a question and I will try to answer it.
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].