HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls\1 = "{"pattern":"https://yoursite.com","filter":{}}"
在Linux中,您需要设置这个文件:
$HOME/etc/opt/chrome/policies/managed/auto_select_certificate.json
With this content:
{
"AutoSelectCertificateForUrls": [ "{\"pattern\":\"*\",\"filter\":{}}" ]
}
设置这个应该会自动允许每个已安装的客户端证书。
如何在C#和Docker中解决此问题的详细文章可以在我写的文章中找到: https://sgedda.medium.com/running-selenium-with-chromedriver-together-with-client-certificate-set-in-headful-mode-with-net-a79bde19e472
尝试下面的代码。它对我有效:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--ignore-urlfetcher-cert-requests");
webDriver = New ChromeDriver(chromeOptions);
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());
ignore-urlfetcher-cert-requests
和 --ignore-urlfetcher-cert-requests
。 - Sven-Michael StübeSystem.setProperty("webdriver.chrome.driver", "D:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--ignore-urlfetcher-cert-requests");
driver = new ChromeDriver(options);
chrome_options.add_argument('--ignore-urlfetcher-cert-requests')