问题描述
在 2.30 版中,selenium webdruiver 提供了对 Safari 浏览器的内置支持.
With version 2.30, selenium webdruiver has given in built support for Safari browser.
我想知道如何在 Safari(安装在 Windows 上)中处理 SSL 证书.
I want to know how to handle SSL Certificates in Safari (which is installed on Windows).
下面是我试过但不起作用的代码:
Below piece of code I tried but its not working:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setBrowserName("SAFARI");
driver = new SafariDriver(capabilities);
driver.get("https://MYDUMMYSITE");
推荐答案
我遇到了同样的问题.看来Safari浏览器使用的认证机制和Internet Explorer一样,理论上可以用它来安装认证,应该可以解决问题.可以在此处
I have countered the same problem. It seems that the Safari browser is using the same certification mechanism as Internet Explorer, and theoretically, you can use it to install certification and it should solve the problem.Instruction can be found here
这对我不起作用,所以我使用 AutoIt 脚本点击继续按钮,将脚本编译为 EXE 并从我的测试中调用它.
This did not work for me, so I used AutoIt script to click on the continue button, compiled the script the EXE and called it from my test.
我使用的脚本:
WinWait("[CLASS:#32770]","",60)
WinActivate("[CLASS:#32770]","")
Send("{SPACE}")
通常,它会等待 60 秒Safari 无法验证网站的身份"消息,将窗口设置为焦点并单击空格键按钮.
Baiscally, it will wait 60 seconds for the "Safari can't verify the identity of the website" message, set the window on focus and click on the space bar button.
这篇关于如何为 Safari 设置AcceptUntrustedCertificates.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!