Skip to content
masterclass Buddy

Playwright · Matcher

toHaveAccessibleName

toHaveAccessibleName checks that a locator points to an element with the expected accessible name. It supports strings, regular expressions, case-insensitive matching, cancellation, and a retry timeout.

Last updated

Since
v1.44

Syntax

await expect(locator).toHaveAccessibleName(name, options);

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

Subscribe
  • LocatorAssertions
  • expect
  • toHaveAccessibleDescription
  • toHaveRole
  • getByTestId

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