Skip to content
masterclass Buddy

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.

Subscribe
  • Locator.fill()
  • Locator.press_sequentially()
  • Locator.focus()
  • Locator.get_by_role()

Source: Actions | Playwright Python. Checked 2026-11-03.