[英]How to disable Insecure Password Warning in Firefox using Selenium Webdriver with Java
[英]How can i resolve insecure connection on mozilla firefox 54 in selenium
我已經將Selenium 3.4和Geckodriver v0.18.0一起使用了。
為了處理Firefox中的SSL證書,我使用了Selenium Webdriver的功能:
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("default");
myprofile.setAcceptUntrustedCertificates(true);
myprofile.setAssumeUntrustedCertificateIssuer(false);
driver = new FirefoxDriver(myprofile);
但是在啟動Firefox后仍然顯示不安全的連接
這是您的問題的答案:
根據沒有參考SSL證書被阻止的url的問題,這是繞過SSL Certificate
的最小代碼塊。 在此代碼塊中,我們將使用DesiredCapabilities
類將ACCEPT_SSL_CERTS
的CapabilityType
設置為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/");
}
}
讓我知道這是否回答了您的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.