Rayrun
← Back to Discord Forum

Multiple Elements that share the same class assert value is present.

Is there a way to assert the elements that share the same class contains a value regardless of all the other values?

expect(page.locator('.classname').toContainText(‘something’);

This thread is trying to answer question "How to assert multiple elements that share the same class contain a specific value?"

2 replies

Would suggest if you gonna work with Playwright it wiil help you to learn how locators work, what is strict matching. https://playwright.dev/docs/locators

@dand33 thank you. I was over complicating it.

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.