Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Puppeteer's page.authenticate() does not work for proxy authorization!
const puppeteer = require('puppeteer');
(async() => {
const proxyUrl = 'http://proxy.example.com:8000';
const username = 'bob';
const password = 'password123';
const browser = await puppeteer.launch({
args: [`--proxy-server=${proxyUrl}`],
headless: false,
});
const page = await browser.newPage();
await page.authenticate({ username, password });
await page.goto('https://www.example.com');
await browser.close();
})();
@dastanaron
Copy link

dastanaron commented Nov 10, 2020

@mnmkng yes I tried the proxies in firefox browser and all of them is working

@dastanaron
Copy link

dastanaron commented Nov 10, 2020

@mnmkng I took proxy in the https://fineproxy.org/ and they is working, but without authorization

@mnmkng
Copy link

mnmkng commented Nov 10, 2020

I tried the IP in your screenshot in my Firefox and could not make it work. http://example.com gave me a cloudflare DNS error. I also tried the code example once again with a different proxy provider and it worked. I'm afraid I can't help any further.

@dastanaron
Copy link

dastanaron commented Nov 10, 2020

@mnmkng Sure, I have deleted it, because I show login and password for all))

@toxx91
Copy link

toxx91 commented Oct 21, 2021

It helped me to specify new paths for --user-data-dir =

'--user-data-dir=C:\\Program Files\\nodejs\\newprofile\\profile+rand(1,1000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment