简体   繁体   English

我如何解决硒中Mozilla Firefox 54上的不安全连接

[英]How can i resolve insecure connection on mozilla firefox 54 in selenium

I have used Selenium 3.4 along with Geckodriver v0.18.0. 我已经将Selenium 3.4和Geckodriver v0.18.0一起使用了。

To handle the SSL certificates in Firefox I used capabilities of Selenium Webdriver: 为了处理Firefox中的SSL证书,我使用了Selenium Webdriver的功能:

ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("default");
myprofile.setAcceptUntrustedCertificates(true);
myprofile.setAssumeUntrustedCertificateIssuer(false);
driver = new FirefoxDriver(myprofile);

But still it is showing an insecure connection after firefox launch 但是在启动Firefox后仍然显示不安全的连接

Here is the Answer to your Question: 这是您的问题的答案:

As per the question without any reference to the url where the SSL certificates are blocking, here is the minimum code block to bypass the SSL Certificate . 根据没有参考SSL证书被阻止的url的问题,这是绕过SSL Certificate的最小代码块。 In this code block we will use the DesiredCapabilities Class to set the CapabilityType of ACCEPT_SSL_CERTS to true as follows: 在此代码块中,我们将使用DesiredCapabilities类将ACCEPT_SSL_CERTSCapabilityType设置为true ,如下所示:

package certificateIssue;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;

public class CertificateIssue_Firefox 
{

    @Test
    public void handleCertificate()
    {
        System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");

        DesiredCapabilities cap= new DesiredCapabilities();
        cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

        WebDriver driver = new FirefoxDriver(cap);
        driver.get("http://www.cacert.org/");

    }
}

Let me know if this Answers your Question. 让我知道这是否回答了您的问题。

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

相关问题 如何使用带有Java的Selenium Webdriver在Firefox中禁用不安全密码警告 - How to disable Insecure Password Warning in Firefox using Selenium Webdriver with Java 如何使用硒在Mozilla FireFox中处理代理身份验证? - How to handle proxy authentication in mozilla firefox using selenium? 如何使用 Selenium WebDrivers 解决此错误? - How can I resolve this error with Selenium WebDrivers? 如何解决异常:丢弃连接 - How can I resolve the exception: discard connection 如何在Heroku上运行的org.mozilla.javascript.optimizer.BodyCodegen中解决此IllegalAccessError问题? - How can I resolve this IllegalAccessError in org.mozilla.javascript.optimizer.BodyCodegen running on Heroku? 不安全的连接错误Firefox v 53.0 - Insecure Connection error Firefox v 53.0 如何禁用Selenium Webdriver和Firefox浏览器的ProPro浏览? - How can I disable provate browsing with selenium webdriver, and firefox browser? 如何在Selenium Webdriver 3中为Firefox驱动程序设置默认配置文件? - How can I set a default profile for the Firefox driver in Selenium Webdriver 3? 如何使用Selenium Webdriver取消在Firefox中的下载? - How can i cancel a download in firefox by using Selenium Webdriver? 如何使用 selenium java 在 firefox 中获取网络和端点信息? - How can i get network and endpoint info in firefox with selenium java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM