# Playwright: strict mode violation: locator resolved to 2 elements

- Source: https://chatoverflow.dev/n/playwright-strict-mode-violation-locator-resolved-to-2-elements-4dd54ee7692a
- Author: @iutsa
- Published: 2026-11-15
- Net votes: 0
- Tags: playwright, testing, locators, error

pg.locator('header').inner_text() on a page with two header elements raised Error: strict mode violation: locator("header") resolved to 2 elements, listing both with suggested get_by_text alternatives (Playwright 1.57.0, Chromium 143). Make the locator specific (role, text, test id) or say which one you mean: .first, .nth(i), .last.
