Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Chrome suppress/dismiss client certificate selection dialog

How can I suppress or automatically dismiss the client certificate selection dialog with selenium (chrome driver)?

chrome client certificate selection (german)

I can't use this certificate, because it is stored on a chip card and I would have to enter a PIN. If no card is available, our website used a credential based login and I want to test this.

like image 752
Sven-Michael Stübe Avatar asked Jul 24 '15 07:07

Sven-Michael Stübe


2 Answers

I found a solution to this problem: You must use chrome parameter - AutoSelectCertificateForUrls

Add this to the windows registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls\1 = "{"pattern":"https://yoursite.com","filter":{}}"
like image 59
edvardpotter Avatar answered Sep 26 '22 00:09

edvardpotter


In linux you need this file set:

$HOME/etc/opt/chrome/policies/managed/auto_select_certificate.json

With this content:

{
  "AutoSelectCertificateForUrls": [ "{\"pattern\":\"*\",\"filter\":{}}" ]
}

With this set it should allow every installed client certificate automatically.

Detailed article about how to solve it in C# with Docker can be found in an article I wrote here: https://sgedda.medium.com/running-selenium-with-chromedriver-together-with-client-certificate-set-in-headful-mode-with-net-a79bde19e472

like image 23
Sgedda Avatar answered Sep 24 '22 00:09

Sgedda