Check and Uncheck Checkboxes
Playwright provides dedicated methods for checkboxes:
locator.check()— checks the checkbox (no-op if already checked)locator.uncheck()— unchecks the checkboxlocator.isChecked()— returns whether it is checked
On the Checkboxes page, #firstSelect1 is an unchecked checkbox.
Task:
- Navigate to
https://testkru.com/Elements/Checkboxes - Print whether
#firstSelect1is checked (should be false) - Check it
- Print whether it is checked now (should be true)
- Uncheck it
- Print final state (should be false)
Expected output:
Initially checked: false After check: true After uncheck: false
TestKru