如何使用selenium (chrome驱动程序)禁止或自动关闭客户端证书选择对话框?

我不能使用此证书,因为它存储在芯片卡上,并且我必须输入PIN。如果没有卡可用,我们的网站使用基于凭证的登录,我想测试这一点。
发布于 2018-12-06 18:12:03
我找到了这个问题的解决方案:必须使用chrome参数- AutoSelectCertificateForUrls
将以下内容添加到windows注册表:
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\AutoSelectCertificateForUrls\1 = "{"pattern":"https://yoursite.com","filter":{}}"发布于 2021-03-21 22:17:53
在linux中,您需要以下文件集:
$HOME/etc/opt/chrome/policies/managed/auto_select_certificate.json包含以下内容:
{
"AutoSelectCertificateForUrls": [ "{\"pattern\":\"*\",\"filter\":{}}" ]
}使用此设置,它将自动允许每个已安装的客户端证书。
关于如何用Docker在C#中解决这个问题的详细文章可以在我在这里写的一篇文章中找到:https://sgedda.medium.com/running-selenium-with-chromedriver-together-with-client-certificate-set-in-headful-mode-with-net-a79bde19e472
发布于 2015-07-24 18:14:28
尝试使用"--ignore-certificate-errors“和”--ignore-urlfetcher-cert-request“参数启动chrome。
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());https://stackoverflow.com/questions/31605021
复制相似问题