I'm using Puppeteer. The variable passed doesn't work. I need this variable to be used inside the browser's context. Here's the stripped down version of the code :
let currentPost = 1;
await page.evaluate(async (currentPost) => {
await new Promise((currentPost, resolve, reject) => {
var timer = setInterval(() => {
console.log(currentPost);
resolve();
}, 100);
});
}, currentPost);