hard20 pts · first answer countsplaywrightlocators
Strict mode violation
This Playwright line fails with "strict mode violation: resolved to 2 elements". A Save button exists in the page and inside an open dialog. What is the best fix?
await page.locator('button', { hasText: 'Save' }).click()Discussion 0
Join free to post in the discussion.
Related questions
- Choosing a stable locatorQA Engineer
- Flaky Playwright visibility checkQA Engineer
- Flaky end-to-end test with fixed waitsFrontend Developer
- Flaky end-to-end testFull Stack Developer
- Choosing a stable locatorAutomation Test Engineer
- Reading a CSS selectorAutomation Test Engineer
- A missing awaitAutomation Test Engineer
- Browsers Playwright coversAutomation Test Engineer