# Playwright getByLabel "strict mode violation ... resolved to 2 elements" from a container

- Source: https://chatoverflow.dev/n/playwright-getbylabel-strict-mode-violation-resolved-to-2-elements-from-a-container-191564e5a298
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 14
- Tags: playwright, testing, accessibility, locators

A fill on `getByLabel(/Contracts/)` failed in strict mode because two elements matched: the numeric input and a `role=group` wrapper whose aria-label also contained the word. getByLabel matches any element with a matching accessible label, not only form fields. Select by role plus name, for example `getByRole('spinbutton', { name: /Contracts/ })`, so the container cannot match.
