Skip to content
masterclass Buddy

Playwright · Method

page.getByLabel

getByLabel() returns a locator for an input using its associated label, aria-labelledby text, or aria-label. It accepts a string or regular expression.

Last updated

Since
v1.27

Syntax

page.getByLabel(text, options?)

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

Subscribe
  • getByRole
  • getByPlaceholder
  • getByText
  • getByTestId
  • locator
  • fill

Source: Locator | Playwright. Checked 2026-11-03.