8

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.

Sven-Michael Stübe
  • 14,560
  • 4
  • 52
  • 103

5 Answers5

5

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":{}}"
edvardpotter
  • 161
  • 1
  • 9
3

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

Sgedda
  • 1,323
  • 1
  • 18
  • 27
0

Try to launch chrome using "--ignore-certificate-errors" and "--ignore-urlfetcher-cert-requests" arguments.

ChromeOptions opts = new ChromeOptions();
opts.addArguments("ignore-certificate-errors","ignore-urlfetcher-cert-requests");
WebDriver driver = new ChromeDriver(opts);
driver.get("http://www.google.com");
System.out.println("Title:" + driver.getTitle());
srees
  • 276
  • 1
  • 4
  • No it still shows the dialog :( I tried it with `ignore-urlfetcher-cert-requests` and `--ignore-urlfetcher-cert-requests` – Sven-Michael Stübe Jul 24 '15 at 11:19
  • 1
    The funny thing is: If I add this to the command line arguments of my chrome desktop link, it is working. But not with Selenium. And for `ignore-certificate-errors` chrome says, that this is an unknown command line switch. But other parameters like `--start-maximized`are passed correctly. – Sven-Michael Stübe Jul 24 '15 at 11:36
  • @Sven-MichaelStübe please raise an issue with chromedriver in below link: https://code.google.com/p/chromedriver/issues – srees Aug 04 '15 at 05:37
  • Sven-Michael, did you find out this problem? I need exactly the same. Thanks! – brobee Dec 04 '17 at 18:01
0

Try below code. It worked for me:

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--ignore-urlfetcher-cert-requests");
webDriver = New ChromeDriver(chromeOptions);
0

I had the same problem. You can cancel this confirmation pop-up directly in Selenium by adding the following argument to ChromeOptions: "--ignore-urlfetcher-cert-requests".

System.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--ignore-urlfetcher-cert-requests");
driver = new ChromeDriver(options);

You have to add :

chrome_options.add_argument('--ignore-urlfetcher-cert-requests')

In any case, it worked for me !