TEST011warningPro

playwright-or-strict-mode

Playwright .or() chain may cause strict mode violation when multiple alternatives match simultaneously.

Applies to: JavaScript, TypeScript

Why this matters

Playwright's strict mode requires locators to resolve to exactly one element. When you chain .or() and multiple alternatives are present on the page, Playwright throws 'strict mode violation' because the combined locator matches more than one element. Use .first() after .or() to explicitly pick one, or check each locator individually.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, TEST011 includedstablestack explain TEST011

TEST011 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: TEST011