Reputation: 55
async function clickElement(page){
await page.evaluate(async () => {
let elements = document.getElementsByClassName('bzsjyuwj ni8dbmo4 stjgntxs ltmttdrg gjzvkazv');
let element = elements[0];
await element.click();
await page.waitFor(111);
alert("Program does not reach here.");
});
}
I am trying to implement a delay while working with puppeteer. However, it seems that code execution does not reach past the waitFor function. How could this be?
Upvotes: 1
Views: 1331
Reputation: 41
OP here, the following works:
await new Promise(function(resolve) {setTimeout(resolve, 2000)});
Upvotes: 4