Playwright · Method
locator.press
Use locator.press() to focus an element and send one key or keyboard shortcut. It accepts logical key names, modifier combinations, and single characters.
Last updated
- Since
- v1.14
Syntax
locator.press(key, **kwargs)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
Locator.fill()Locator.press_sequentially()Locator.focus()Locator.get_by_role()