Reputation: 11
Very basic question but I can't figure it out.
How do I test for the existence of a piece of text on a page?
e.g. does the word "mouse" exist on this page? I'm using playwright and node.js
Thanks!
Upvotes: 0
Views: 64
Reputation: 3152
You can do that via page.waitForSelector(). Example:
await page.waitForSelector('text=mouse')
See on playwright.dev for the full documentation and how you can use the text selectors in other scenarios.
Upvotes: 1