I would like to have these two setInterval functions running in parallel - and looping , however the result I'm getting with the code below is that the first function runs once, and then only the second one keeps getting repeated after it's interval.
await Promise.all([
page.evaluate(() => {
setInterval(() => {
(() => {
let i = 0;
const followInterval = setInterval(() => {
if (i >= 2) {
clearInterval(followInterval);
return;
}
const buttons = document.querySelectorAll('button');
const nextButton = buttons[i];
nextButton.click();
i += 1;
}, 500)
})();
}, 7000)
}),
setInterval(() => {
page.reload(true)
}, 11000)
]);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…