这里专门开个帖子用来整理采集遇到的问题

新的chrome headless模式 headless=new

PHPer 2023-11-28 212 0 0

今天升级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...

    推荐内容

    怎样使用V2Ray代理和SSTap玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩...

    sstap游戏代理教程 从此玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩虹六...

    BT磁力搜索网站汇总和找不到的资源

    什么是磁力链接,您如何使用?

    Z-Library:全球最大的数字图书馆/含打不开的解决方案/镜像

    使用V2Ray的mKCP协议加速游戏

    v2rayN已停止工作

    【车险课堂】什么是无赔款优待系数ncd,你“造”吗?