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(); | |
})(); |
puppeteer 5.4.1 not working
@dastanaron I just tested it with puppeteer 5.4.1 and it works for me. What's your issue?
@dastanaron I just tested it with puppeteer 5.4.1 and it works for me. What's your issue?
I tried proxy without autorization, authorization with page.authenticate()
method, with headers method page.setExtraHTTPHeaders(...)
. But i see only error ERR_TUNNEL_CONNECTION_FAILED or ERR_CONNECTION_CLOSED or other proxy errors. I try change proxy, example i tried sock5 proxy, http, https, with authorization, without authorization, it is not working
Have you tried the proxies manually in your browser or with a different library (such as axios
) to see if the proxy servers are actually working?
@mnmkng yes I tried the proxies in firefox browser and all of them is working
@mnmkng I took proxy in the https://fineproxy.org/ and they is working, but without authorization
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.
@mnmkng Sure, I have deleted it, because I show login and password for all))
It helped me to specify new paths for --user-data-dir =
'--user-data-dir=C:\\Program Files\\nodejs\\newprofile\\profile
+rand(1,1000)
This did not work for me getting error: Protocol error (Target.createTarget): Target closed
@aditodkar Weird, that usually happens when you're trying to work with a resource (browser, page) that crashed or is not available anymore. Sure you're not getting any errors or missing await
?
@mnmkng I am running puppeteer + aws lambda with proxy servers. Check this code snippet. I also tried running crawlee in aws lambda but did not work for me please check this discord discussion on apify discord channel.
Running Chromium or any headless browser on Lambda is always pain. I have not done it in a long time so can't help unfortunately. It's one of the reasons we created Apify. Because running browsers on existing serverless platforms is a constant struggle.
But Apify platform is also built on aws lambda right?
Not at all :) Apify runs primarily on EC2 and Actors run in Docker.
Not at all :) Apify runs primarily on EC2 and Actors run in Docker.
Thanks a lot for the info :)
+1 same. it hangs and crashes