简体   繁体   English

如何绕过https安全证书屏幕?

[英]How can I bypass the https security certificate screen?

I have created some java classes that use testng and selenium frameworks. 我创建了一些使用Testng和Selenium框架的Java类。 For the moment, when I execute the tests with Chrome/Firefox, they run smoothly. 目前,当我使用Chrome / Firefox执行测试时,它们运行平稳。

However, when I execute those tests with Internet Explorer, the security certificate message is shown. 但是,当我使用Internet Explorer执行这些测试时,将显示安全证书消息。

How can I bypass this screen and continue with the execution of my tests ? 如何绕过此屏幕并继续执行测试? Browser Screenshot 浏览器截图


I used these two lines of code as well: 我也使用了这两行代码:

webDriver.get("javascript:document.getElementById('overridelink').click();"); webDriver.get(“ javascript:document.getElementById('overridelink')。click();”);

or 要么

webDriver.navigate().to("javascript:document.getElementById('overridelink').click();"); webDriver.navigate()。to(“ javascript:document.getElementById('overridelink')。click();”);

In either case, the link is not pressed. 无论哪种情况,都不会按下链接。

I am using Internet Explorer 11. 我正在使用Internet Explorer 11。

  1. You can try to install self signed certificate. 您可以尝试安装自签名证书。 In Windows Internet Explorer, click Continue to this website (not recommended). 在Windows Internet Explorer中,单击“继续浏览此网站”(不推荐)。

    • A red Address Bar and a certificate warning appear. 出现红色的地址栏和证书警告。
    • Click the Certificate Error button to open the information window. 单击证书错误按钮以打开信息窗口。
    • Click View Certificates, and then click Install Certificate. 单击“查看证书”,然后单击“安装证书”。
    • On the warning message that appears, click Yes to install the certificate. 在出现的警告消息上,单击“是”以安装证书。

If you are not satisfied or it did not help to solve the problem you have actually many ways how to obey the warning page or solving the problem. 如果您不满意或对解决问题没有帮助,实际上您可以通过多种方式遵守警告页面或解决问题。 I am not sure which will help to fix your problem because you did not provide much information..... try for example this one: 我不确定这将有助于解决您的问题,因为您没有提供太多信息.....请尝试以下示例:

  1. Try to turn off publishers and servers cert. 尝试关闭发布者和服务器证书。 revocation Launch Internet Explorer on a desktop computer. 吊销在台式计算机上启动Internet Explorer。
    • Click Tools -> "Internet Options" window appears -> Advanced tab 单击工具->出现“ Internet选项”窗口->高级选项卡
    • Under "Security", uncheck the boxes "Check for publisher's revocation" and "Check for server certificate revocation.". 在“安全性”下,取消选中“检查发布者的撤销”和“检查服务器证书的撤销”框。

It should do the trick. 它应该可以解决问题。 If not, please try to provide more info. 如果没有,请尝试提供更多信息。

You can use desired capability class to overcome this. 您可以使用所需的功能类来解决此问题。 Please find the code below, 请在下面找到代码,

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
System.setProperty("webdriver.ie.driver","IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver(capabilities);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM