lundi 2 mars 2020

Node js if/else not functioning properly using puppeteer

var available = await page.waitForSelector('[name="commit"]')
if (available) {
    await page.click('[name="commit"]')
    console.log('success');
} else {
    await browser.close();
    console.log('unavailble');
}

'''

I would like the code to look for a selector, if it has it then continue, but if not, i want it to retry again. What can be changed to make this function properly? thanks in advance.

Aucun commentaire:

Enregistrer un commentaire