Considering the following example :
page.setDefaultTimeout(2000); // set a default timeout of 2s on the page
await page.$eval('selector', (el) => {
while (true) {
// do some stuff
}
});
What will happen ? Does the loop blocks the execution forever or is it interrupted by the timeout ?
From the following test the answer is NO the page timeout
will not interrupt an endless loop in pageFunction
.
page.setDefaultTimeout(1000);
await page.exposeFunction('log', (val) => console.log(val));
await page.goto('https://www.google.com/');
await page.$eval('body', (el) => {
let a=0;
while (true) {
log(a++);
}
});