Skip to content
masterclass Buddy

Playwright · Method

locator.textContent

locator.text_content() returns the DOM textContent of the matched element. It returns a string or None and waits for the locator up to the configured timeout.

Last updated

Since
v1.14

Syntax

locator.text_content(timeout=timeout)

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

Subscribe
  • locator.all_text_contents
  • locator.all_inner_texts
  • expect(locator).to_have_text
  • locator.inner_text

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