Skip to content
masterclass Buddy

Playwright · Matcher

toHaveValue

toHaveValue checks that a locator points to an element with the expected input value. It supports strings and regular expressions and retries until the condition passes or the assertion timeout is reached.

Last updated

Since
v1.20

Syntax

await expect(locator).toHaveValue(value[, options])

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

Subscribe
  • expect
  • LocatorAssertions
  • toHaveValues
  • TestConfig.expect

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