>评估页面时使用? 解决方案 **已更新,适用于puppeteer v1.4.x 如果你想要的只是记录页面的进度。评估到控制台,那么只需 const page =等待browser.newPage(); page.on('console',consoleObj => console.log(consoleObj.text())); 并在 console.log c $ c> page.evaluate 像往常一样,不再需要依赖项。 另见这个很好的调整,从日志中删除多个烦人的警告。 How can I console.log something inside the page.evaluate, passing it to node and using it during the evaluation of the page?I actually want to log the progress of the page.evaluate to the console and show some results to the user. 解决方案 **Updated to work with puppeteer v1.4.xIf all you want is to "log the progress of the page.evaluate to the console", then justconst page = await browser.newPage();page.on('console', consoleObj => console.log(consoleObj.text()));And use console.log in page.evaluate as usual, no more dependencies are required.Also see this nice tweak to remove multiple annoying warnings from log. 这篇关于Puppeteer登录页面。评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 01:09