Playwright · Matcher
toHaveId
toHaveId checks that a locator points to an element with a specific DOM id. It retries until the ID matches or the assertion times out.
Last updated
- Since
- v1.20
Syntax
await expect(locator).toHaveId(id, options);In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expectLocatortoHaveAttributetoHaveRoletoHaveText