chrome-launcher icon indicating copy to clipboard operation
chrome-launcher copied to clipboard

Launch chrome with proxy

Open jackwicklow1 opened this issue 5 years ago • 3 comments

Hi. Is it possible to launch the browser with a proxy at all? The only way I can figure out is to launch, connect to the browser using puppeteer, and then use puppeteer-page-proxy to change the proxy for that page. Thanks

jackwicklow1 avatar Jul 19 '20 22:07 jackwicklow1

You can use the proxy command-line flags

const {launch} = require('chrome-launcher')
launch({chromeFlags: ['--proxy-server=<scheme>=<uri>[:<port>]']})

patrickhulce avatar Jul 20 '20 01:07 patrickhulce

(node:22552) UnhandledPromiseRejectionWarning: Error: net::ERR_NO_SUPPORTED_PROXIES at https://www.google.com

You can use the proxy command-line flags

const {launch} = require('chrome-launcher')
launch({chromeFlags: ['--proxy-server=<scheme>=<uri>[:<port>]']})

Thanks for the reply. When I launch chrome with these chromeFlags and try to load a page, an error occurs: (node:22552) UnhandledPromiseRejectionWarning: Error: net::ERR_NO_SUPPORTED_PROXIES at https://www.google.com

The line which launches chrome is as follows: chrome[i] = await chromeLauncher.launch({chromeFlags: ['--proxy-server="52.71.28.74:3112"']});

I also need to authenticate the proxy too but I'm not sure how to do that.

Thanks

jackwicklow1 avatar Jul 20 '20 09:07 jackwicklow1

@jackwicklow1 yes you will need to replace the components of --proxy-server=<scheme>=<uri>[:<port>] with scheme, uri, and port as necessary according to the linked Chromium documentation.

I also need to authenticate the proxy too but I'm not sure how to do that.

Looks like you can't but there are workarounds.

patrickhulce avatar Jul 20 '20 14:07 patrickhulce