Playwright · Junior · Question 21 of 75
What happens when a locator used in click() matches three elements?
- 1Playwright clicks the first element
- 2Playwright clicks all three elements
- 3The action fails with a strictness error
Show the answer
Correct answer: The action fails with a strictness error
Explanation
Actions are strict: they require exactly one match, so you don't click the wrong element by accident. Narrow the locator or use first()/nth() deliberately.