Playwright · Junior · Question 28 of 75
How do you tick a checkbox in Playwright?
- 1
await locator.select() - 2
await locator.check() - 3
await locator.toggle(true)
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.