puppeteer
puppeteer copied to clipboard
How do I get rid of popup for chromium certificates selection, can I set it programmatically ?
Is there another way without disabling the popup via puppeteer launch ? I tried dialog stuff but it seems not the way.
Would the ignoreHTTPSErrors option in puppeteer.launch help you?
This seems like it's related to managed policies: https://stackoverflow.com/a/27859775/315562
ignoreHTTPSErrors doesn't help me on this.
Looks like Chromium runs without the managed policies of the machine, which is good in the sense that it runs in a clean state (not inheriting machine's settings). Or it could just be doing this because the managed application is "Google Chrome", not set to "Chromium". However, there seems to be no API to toggle or add managed policies for through puppeteer.
Maybe following the Debugging section of this helps: http://www.chromium.org/administrators/mac-quick-start
You are right @chrisirhc, there should be an api to toggle this, for others running the script headlessly. I tried using chrome canary as my executable_path but still not working.
I run into the same certificate popup dialog, anybody knows how to get rid of it?
@fusionx1 How do you solve the problem finally?
Still unresolve
On Wed, Oct 25, 2017 at 9:34 PM, 赖小赖 [email protected] wrote:
@fusionx1 https://github.com/fusionx1 How do you solve the problem finally?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoogleChrome/puppeteer/issues/540#issuecomment-339331509, or mute the thread https://github.com/notifications/unsubscribe-auth/AAnPOnvc1POoMzldr8N8FqO7b_EQbxVaks5svzkAgaJpZM4PCbXv .
I have the same problem, hope it to be resolved as soon as possible.
Same problem here, but I want to select one certificate to "log in" @aslushnikov you were asking for an example of this here: https://github.com/GoogleChrome/puppeteer/issues/1319#issuecomment-356499820
This solution worked for me! So I share it with everyone here. https://www.chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls
I successfully worked around this on OS X 10.13 just now with Chromium 68.0.3419.0. Setting the AutoSelectCertificateForUrls policy is the right approach. But the documentation at https://www.chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls is wrong.
The commands that worked for me:
defaults write org.chromium.Chromium AutoSelectCertificateForUrls -array
defaults write org.chromium.Chromium AutoSelectCertificateForUrls -array-add -string '{"pattern":"[*.]example.com","filter":{}}'
The format of the pattern is the key; the policy docs give an example of https://www.example.com but the actual value apparently needs to be a hostname pattern rather than a URL pattern. (I'm not 100% sure of that, but URL patterns don't work for me and the format above does.)
In this example I left the filter blank since I don't need filtering for my use case, but you can put a value there if you need one.
This isn't ideal since you're setting the preference for all Chromium invocations for your account rather than for a specific Puppeteer invocation. It would definitely be better to have an API to set this, and for that matter to programmatically supply a client certificate rather than using the system keychain. But the workaround at least helps.
Was there any update on this? Electron has a well working api for client certificate selection.
In my case client certificate is different for each user (SubjectName) and I need to provide it before I'm presented with the login screen. I can do this easily with electron, but I'm stucked with puppeteer and can't figure out if the pattern in auto selection can achive this without me setting each time with a fixed subject name before I lunch chrome via puppeteer.
Yes there is a solution to this!
@dapriett shows in this comment how you can intercept Puppeteer's network request using page.setRequestInterception, and then make the request manually yourself with the necessary cert data, and then set the response using interceptedRequest.respond. In his example he uses request, but you could use anything that allows you to set the cert information on an HTTP request.
headless not working~
@Explorer1092 Did you ever figure out how to get this working with headless mode?
The solution given in this comment is working perfectly: https://github.com/GoogleChrome/puppeteer/issues/1319#issuecomment-371503788
You can use multiple certificates to login in the same webpage without touching the security policies. The thread is already referenced in this one.
This solution worked for me! So I share it with everyone here. https://www.chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls
what should I do exactly to make it work?
I am using puppeteer with default chromium
@Explorer1092 Did you ever figure out how to get this working with headless mode?
Yes, this would be CI/CD practical if it worked in headless mode. I’ve been trolling the internet for weeks trying to solve it in headless mode.
Did anyone manage to get this working on headless mode?
Did anyone manage to get this working on headless mode?
Not exactly, but we built a reverse proxy servlet and extended the chromedriver in java. Another easier workaround is just to install a Nginx, Apache, etc... web server and use that to proxy all your requests and inject the certificate headers. In either case, proxy the requests.
@lester289 @bordenit
GOTO:
The solution given in this comment is working perfectly: #1319 (comment)
You can use multiple certificates to login in the same webpage without touching the security policies. The thread is already referenced in this one.
The workaround in https://github.com/GoogleChrome/puppeteer/issues/1319#issuecomment-371503788 does not work for form submissions that include file uploads, because https://github.com/puppeteer/puppeteer/issues/5097 prevents request interceptors from reading multipart payloads.
Did anyone manage to get this working?
I've some doubts, with the workaround in https://github.com/puppeteer/puppeteer/issues/1319#issuecomment-371503788 should chromium show a valid SSL connection? (with the padlock)
I'm trying to use a pfx certificate but seems like the site doesn't recognize it
agentOptions: {
requestCert: true,
rejectUnauthorized: false,
pfx: fs.readFileSync(__dirname + '/certs/cert.pfx'),
passphrase: 'passphrase'
}
I successfully worked around this on OS X 10.13 just now with Chromium 68.0.3419.0. Setting the
AutoSelectCertificateForUrlspolicy is the right approach. But the documentation at https://www.chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls is wrong.The commands that worked for me:
defaults write org.chromium.Chromium AutoSelectCertificateForUrls -array defaults write org.chromium.Chromium AutoSelectCertificateForUrls -array-add -string '{"pattern":"[*.]example.com","filter":{}}'The format of the pattern is the key; the policy docs give an example of
https://www.example.combut the actual value apparently needs to be a hostname pattern rather than a URL pattern. (I'm not 100% sure of that, but URL patterns don't work for me and the format above does.)In this example I left the filter blank since I don't need filtering for my use case, but you can put a value there if you need one.
This isn't ideal since you're setting the preference for all Chromium invocations for your account rather than for a specific Puppeteer invocation. It would definitely be better to have an API to set this, and for that matter to programmatically supply a client certificate rather than using the system keychain. But the workaround at least helps.
This worked like a charm. Thank you!
In my case, I was actually running into this issue in the Sidekick browser (a really awesome Chrome alternative built on Chromium). In case anyone out there is dealing the same issue and stumbles across this thread as I did, you just need to change the plist file name to com.pushplaylabs.sidekick, so the terminal commands become:
defaults write com.pushplaylabs.sidekick AutoSelectCertificateForUrls -array
defaults write com.pushplaylabs.sidekick AutoSelectCertificateForUrls -array-add -string '{"pattern":"[*.]example.com","filter":{}}'
And as mentioned, be sure your pattern matches the hostname, NOT the full URL pattern.
O mesmo problema aqui, mas quero selecionar um certificado para "fazer login" @aslushnikov você estava pedindo um exemplo disso aqui: https://github.com/GoogleChrome/puppeteer/issues/1319#issuecomment-356499820
I'm having this problem in 2021, I need to select a specific certificate, could you reference me a solution?
I couldn't find any solution for the pop-up certificate issue? Has anybody resolved this?
The request interception isnt working. The certificate modal is still opened. How do I proceed? Anyone got a clue?
same problem i dont found solution to the popup and select certificate :(