10 - Playwright With TypeScript - How to handle Checkboxes
Sample Page
https://www.testmuai.com/selenium-pla...
check()
await page.locator('#checkbox1').check();
uncheck()
await page.locator('#checkbox1').uncheck();
isChecked()
await page.locator('#checkbox1').isChecked();
isEnabled()
await page.locator('#checkbox1').isEnabled();
assertion - means checkbox is expected to be in checked state and not checked state
await expect(page.locator('#checkbox1')).toBeChecked();
await expect(checkbox).not.toBeChecked();
Handle Multiple Checkboxes
const checkboxes = page.locator('input[type="checkbox"]');
await checkboxes.nth(i).check();
#playwright #playwrighttutorial #playwrightwithtypescript #checkboxes #automationtesting #automationtestinginterviewquestions #qatraining #letslearnqa