Skip to content
masterclass Buddy

Playwright · Method

locator.filter

locator.filter() narrows an existing Playwright locator by text or by matching or excluding descendants. You can chain filters to identify one element without relying on position.

Last updated

Since
v1.22

Syntax

locator.filter(options)

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

Subscribe
  • Locator
  • Locator.locator
  • Locator.getByRole
  • Locator.getByText
  • Locator.getByTestId
  • Locator.all

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