puppeteer page.authenticate https 代理不起作用

use*_*197 3 https proxy node.js puppeteer

运行 puppeteer 时代理身份验证失败。

傀儡师版本:1.8

平台/操作系统版本:MacOS 10.13.6

Node.js版本:v10.9.0

    const puppeteer = require('puppeteer');

    (async () => {
        const browser = await puppeteer.launch({
        headless:false,
        ignoreHTTPSErrors:true,
        devtools:true,
        timeout:3000,
        args: ['--no-sandbox','--proxy-server=xxx:xxx']
     });
     const user='xxx';
     const password='xxx';
     const page = await browser.newPage();
     // await page.setExtraHTTPHeaders({
     //   'Proxy-Authorization': 'Basic ' + Buffer.from(`${user}:${password}`).toString('base64'),
   // });
     await page.authenticate({username:user, password:password});
     await page.goto('https://www.apple.com/');
     let title = await page.title();
     console.log("title:" + title);
     await browser.close();
    })();
Run Code Online (Sandbox Code Playgroud)

出现错误:

(node:5858) UnhandledPromiseRejectionWarning: 
Error: net::ERR_TUNNEL_CONNECTION_FAILED at https://www.apple.com/
at navigate (/xxx/node_modules/_puppeteer@1.8.0@puppeteer/lib/Page.js:622:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:5858) UnhandledPromiseRejectionWarning:
Unhandled promise rejection. This error originated either by throwing
inside of an async function without a catch block, 
or by rejecting a promise which was not handled with .catch(). 
(rejection id: 1)
Run Code Online (Sandbox Code Playgroud)

小智 6

const puppeteer = require('puppeteer');

(async () => {
    const browser = await puppeteer.launch({
    headless:false,
    ignoreHTTPSErrors:true,
    devtools:true,
    timeout:3000,
    args: ['--no-sandbox','--proxy-server=https=xxx:xxx']
 });
 const user='xxx';
 const password='xxx';
 const page = await browser.newPage();
 await page.authenticate({username:user, password:password});
 await page.goto('https://www.apple.com/');
 let title = await page.title();
 console.log("title:" + title);
 await browser.close();
})();
Run Code Online (Sandbox Code Playgroud)

对我来说,它是通过在代理服务器参数之间添加 https 来实现的。