Playwright · Junior · Question 21 of 75

What happens when a locator used in click() matches three elements?

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.

Further reading

Problem with a question

Playwright · Junior · question 21

Test yourself

Take the Playwright · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz