Skip to content
masterclass Buddy

Playwright · Method

page.getByText

page.getByText locates elements using their text. It supports substring matching, exact matching, and regular expressions.

Last updated

Since
v1.27

Syntax

Page.GetByText(string text, PageGetByTextOptions? options = null)

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

Subscribe
  • Locator.Filter
  • GetByRole
  • GetByLabel
  • GetByTitle
  • GetByTestId

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