Skip to content
masterclass Buddy

Playwright · Method

page.focus

Use locator.focus() to move keyboard focus to an element. It helps test pages that change behavior when an element receives focus.

Last updated

Syntax

locator.focus()

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • Page.focus
  • Locator
  • Page.get_by_label

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