|-转 新的chrome headless模式 headless=new
今天升级Puppeteer到20的版本,发现有一个警告,提示headless有问题
Puppeteer old Headless deprecation warning:[0m[33m In the near future `headless: true` will default to the new Headless mode for Chrome instead of the old Headless implementation. For more information, please see https://developer.chrome.com/articles/new-headless/. Consider opting in early by passing `headless: "new"` to `puppeteer.launch()` If you encounter any bugs, please report them to https://github.com/puppeteer/puppeteer/issues/new/choose.
Puppeteer使用新参数例子: 原来的headless参数默认是true,那么新的需要手动传入new,如果是false则不变
const PCR = require('puppeteer-chromium-resolver'); const stats = await PCR({}); const browser = await stats.puppeteer.launch({ headless: 'new', // `headless: true` (default) enables old Headless; // `headless: 'new'` enables new Headless; // `headless: false` enables “headful” mode. });
由于统一了模式,那么比如像扩展插件,打印pdf,截图,等等都可以实现两端一致,大家可以试试
...
浏览更多内容请先登录。
立即注册
更新于:2023-11-28 01:17:47
相关内容
php获取链接跳转的真实地址
curl超时的设置
Chrome插件安装教程
如何通过Chrome查看网站登录 Cookie 信息
Chrome浏览器:The request client is not a secure context and the reso...
推荐内容