I'm working on a Selenium project and the system I need to test is using an SSL certificate. Every time when I try to login we are getting this "Select a certificate" window which we cannot handle with WebDriver.
I have tried clicking OK button using AutoItx as below. But the Send("{ENTER}")
is not the best option.
if (AutoItX.WinWaitActive("data:, - Google Chrome", "", 10) == 0)
{
AutoItX.WinActivate("data:, - Google Chrome");
AutoItX.Send("{ENTER}");
}
Is there a way to click on OK button using AutoItX? Or is there a way we can load this certificate when defining ChromeDriver by using Capabilities?
Open your Settings, select Security. Choose Trusted Credentials. Select the certificate you'd like to remove. Press Disable.
You can tell Chrome to ignore all SSL certificate errors by passing the following at the command line at launch. If you're on Windows simply right-click into the properties of the launcher. Then add --ignore-certificate-errors in the target field. Then restart Chrome.
Create registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls
Here create new String value (REG_SZ) with name 1
As Value data enter:
{"pattern":"[*.]","filter":{}}
This is how the registry then looks like.
For more information on this key I found:
The value must be an array of stringified JSON dictionaries. Each dictionary must have the form { "pattern": "$URL_PATTERN", "filter" : $FILTER }, where $URL_PATTERN is a content setting pattern. $FILTER restricts from which client certificates the browser will automatically select. Independent of the filter, only certificates will be selected that match the server's certificate request. If $FILTER has the form { "ISSUER": { "CN": "$ISSUER_CN" } }, additionally only client certificates are selected that are issued by a certificate with the CommonName $ISSUER_CN. If $FILTER is the empty dictionary {}, the selection of client certificates is not additionally restricted.
on Automatically select client certificates for these sites
Create registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls
Here create new String value (REG_SZ) with name 1
As Value data enter:
{"pattern":"[*.]mycompany.com","filter":{"ISSUER":{"CN":"MyCompanyCA"}}}
MyCompanyCA and the subdomain mycompany.com must be replaced with your corresponding url and issuing company.
If you have multiple certificates and the one you want to select is not the first one then you will need to apply a filter.
http://www.chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls has an in-depth description of the filter values, but you're probably not interested in most of them and can use:
{"pattern":"[*.]","filter":{"ISSUER":{"CN":"[Issued By]"}}}
replacing [Issued By] with the issuer of your client certificate. I can't for the life of me manage to get the URL pattern working with anything more specific than [*.], which matches any URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With