I would like to trigger a function that runs in node from the browser. How can I do this?
let log = () => console.log("helsadfl");
await page.evaluate((log) => {
document.addEventListener("click", function () {
console.log(log);
});
}, log);
Additional: Why is this not able to console.log the target?
await page.exposeFunction("log", (e) => console.log(e.target));
await page.evaluate(() => {
document.addEventListener("click", log);
});