Im new to Javascript/Playwright, I have a scenario where I want to uncheck few checkboxes( e.g 1,3,5 8
checkboxes ) from already pre-selected checkbox list(10 checkboxes)
I tried to uncheck all checkboxes and check only required, this approach is working fine but would like to know if there is a better way to achieve this in javascript
let role ='checkbox';
async uncheckAll(role)
{
const checkboxes = this.page.getByRole(`${role}`);
for (const checkbox of await checkboxes.all())
await checkbox.uncheck();
}
Aucun commentaire:
Enregistrer un commentaire