Chrome on Windows : Automatic Client Certificate selection while using Selenium

To avoid the browser prompt for certificate selection (which requires code outside of Selenium like autoIt/Sikuli)

1. Import the certificate to Windows CAPI

a. You can use IE to import the certificate and store it in in “My Certificate” tab.

or, b. You can use below command to import the certificate

“certutil -f -user -p <password>  -importpfx <certificate>”

If you are automating the flow and may want to delete older certificate , You can use bolo code written in Java

String allCerts = execCommand.runCommand(“certutil -store -user My”);

List<String> CN = new ArrayList<String>();

int a = allCerts.indexOf(“, CN=”);

int b = allCerts.lastIndexOf(“, CN=”);

int c = allCerts.indexOf(” Non-root Certificate”);

int l = 0;

while( a <= b && a!=-1){

CN.add(allCerts.substring(a+5,c ));

String delCerts = execCommand.runCommand(“certutil -delstore -user My \”” + CN.get(l) + “\””);“Deleting “ + CN.get(l) + ” : “ + delCerts);


a = allCerts.indexOf(“, CN=”,i+1);

c = allCerts.indexOf(” Non-root Certificate”,c+1);


2. To let Chrome automatically select the certificate automatically:

Edit registry entry:  (If it does not exist, create it )


Add Key: 1

Value: {{“pattern”:”[*.]”,”filter”:{“ISSUER”:{“CN”:”ABHAY_ISSUER”}}}}

–> with above content, a certificate issued from CA “ABHAY_ISSUER” will automatically get selected when user access <any>