Hello everyon, i want to add a specific certificate to my chrome options, i have been struggling for hours. Let me know if you have any type of solution. here is the example simplified code:
chrome has no command line flag that takes a .pem, so there is nothing to put in ChromeOptions for this, and --user-data-dir= pointing at the cert path only creates a fresh empty profile folder there. certificates live in the os store (chrome reads it), so the fix is one import outside the test.
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n my-ca -i certificate.pem
after that a plain openBrowser trusts the site, you can drop --ignore-certificate-errors.
if it is a client certificate (the site asks you to pick one), import the .p12 into the personal store instead and add a chrome policy so the picker never shows: registry key HKLM\Software\Policies\Google\Chrome\AutoSelectCertificateForUrls with a value like {"pattern":"https://example.com","filter":{}}. that is the only way to make the dialog go away, selenium cannot click it.
If I am not wrong Chrome can’t take a cert file through ChromeOptions, and --user-data-dir just creates an empty profile. So, Import the certificate into the OS store instead (certutil -addstore Root cert.pem on Windows, the NSS db on Linux). If the site asks for a client certificate, import the .p12 and set Chrome’s AutoSelectCertificateForUrls policy to skip the picker.