How to setAcceptUntrustedCertificates for Safari.

a 夏天 提交于 2019-12-11 04:59:30

问题


With version 2.30, selenium webdruiver has given in built support for Safari browser.

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");

回答1:


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

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.

The script I used:

WinWait("[CLASS:#32770]","",60) 
WinActivate("[CLASS:#32770]","")
Send("{SPACE}")

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.



来源:https://stackoverflow.com/questions/22601072/how-to-setacceptuntrustedcertificates-for-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!