【问题标题】:How to open link with using puppeter wsendpoint如何使用 puppeteer wsendpoint 打开链接
【发布时间】:2017-11-12 07:57:05
【问题描述】:

我尝试像这样将浏览器与 wsendpoint 连接:

(async () => {  


 const browser = await puppeteer.connect({browserWSEndpoint: 'ws://localhost:9222/devtools/page/eedbdd50-cd25-472d-a701-a0302d9ffe2f'});
  const page = await browser.newPage();
  await page.goto('https://www.google.com.tr');  
})();

此代码可以打开新标签,但不要转到链接。它给出错误:

(node:2022) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Protocol error (Performance.enable): 'Performance.enable' wasn't found undefined
(node:2022) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

【问题讨论】:

    标签: node.js google-chrome-headless puppeteer


    【解决方案1】:

    试试这个:

    const puppeteer = require('puppeteer');
    
    puppeteer.connect({
      browserWSEndpoint: 'your endpoint...'
    }).then(async browser => {
      const page = await browser.newPage();
      await page.goto('https://www.google.com.tr');
    });
    

    【讨论】:

      猜你喜欢
      • 2018-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-18
      • 2011-11-05
      • 1970-01-01
      相关资源
      最近更新 更多