Playwright · Matcher
toBeFocused
toBeFocused() checks that a locator points to the currently focused DOM node. It retries until the check passes or the assertion timeout is reached.
Last updated
- Since
- v1.20
Syntax
await expect(locator).toBeFocused();In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
LocatorAssertionsnottoBeVisibletoHaveFocus