Playwright · Matcher
toHaveCount
toHaveCount asserts that a locator matches an exact number of DOM nodes. It retries until the count matches or the assertion timeout is reached.
Last updated
- Since
- v1.20
Syntax
await expect(locator).toHaveCount(count, options);In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expectLocatortoHaveTextlocator.countlocator.all