Puppeteer multiline waitForFunction method
You need to pass in x
and y
- currently they're parameters. You can also simplify your function a little:
await page.waitForFunction((x, y) => (x && y ? true : undefined), {}, x, y);
You need to pass in the x
and y
arguments to the waitForFunction
.
console.log(x,y); // 24 42await page.waitForFunction((x, y) => { console.log(x, y); // undefined, undefined if(x && y) { return true; }}, {}, x, y);