Playwright · Junior · Question 28 of 75

How do you tick a checkbox in Playwright?

Show the answer

Correct answer: await locator.check()

Explanation

check() makes sure the box ends up checked, and does nothing if it already is. uncheck() does the opposite; setChecked(bool) handles both.

Further reading

Problem with a question

Playwright · Junior · question 28

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