Skip to content
masterclass Buddy

Playwright · Matcher

toContainText

Playwright assertions check values and web page state. Web-specific matchers retry until the expected condition passes or the assertion timeout is reached; generic matchers check immediately.

Last updated

Syntax

expect(value).matcher(expected)
await expect(locator).matcher(expected)
expect.soft(value).matcher(expected)
expect(value).not.matcher(expected)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • expect
  • expect.poll
  • expect.toPass
  • expect.soft
  • LocatorAssertions
  • toHaveText
  • toContainText
  • toHaveTitle

Source: Assertions | Playwright. Checked 2026-11-03.