How to pass a function in Puppeteers .evaluate() method?
问题 Whenever I try to pass a function, like this: var myFunc = function() { console.log("lol"); }; await page.evaluate(func => { func(); return true; }, myFunc); I get: (node:13108) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Evaluation failed: TypeError: func is not a function at func (<anonymous>:9:9) (node:13108) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the