美文网首页
puppeteer问题总结

puppeteer问题总结

作者: 刘晓佳rachel | 来源:发表于2020-11-20 09:27 被阅读0次

1、浏览器启动失败

原因:executablePath指向的是executablePath:'C:/Program Files/Google/Chrome/Application',而不是chrome.exe。

修改:若使用本地chrome,注意一定要指向chrome.exe才能正常使用。

2、启动的浏览器自适应系统分辨率

设置defaultViewport参数为null即可,例如:

const browser = await puppeteer.launch({

        executablePath:'C:/Program Files/Google/Chrome/Application/chrome.exe',

        headless: false,

        defaultViewport:null

    })

相关文章

网友评论

      本文标题:puppeteer问题总结

      本文链接:https://www.haomeiwen.com/subject/bmaszctx.html