I have a list of checkboxes , every time puppeteer run the test I need to :
- if a box is already selected then move to next box and select it , and if the next is selected move to the next checkbox and so on
if(await page.$eval(firstcheckbox, check=>check.checked =true)) { //check if the box is selected await page.waitForSelector(do something, ele=>elem.click())//if the checkbox is already selected , move to the second row and select a undecked box
}else if{
await page.$eval(firstcheckbox, check=>check.checked =false)){ //if the checkbox is not ticked await page.$eval(clickcheckbox, elem=>elem.click);//tick the checkbox
You can use all the testing and changing inside one
page.evaluate()
:Or, if you need a loop over element handles, you can try this: