问题
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