2

I am working with BrowserMob-Proxy and Selenium. Loading pretty much any URL results in a Your connection is not secure, Error code:SEC_ERROR_UNKNOWN_ISSUER error in the browser. However, when I import the certificate given by BMP (via Firefox->Options->Advanced->Certificates->Import), everything works smoothly.

My question is how to do this programmatically. I have already tried

profile.accept_untrusted_certs = True

but that doesn't seem to have any affect at all. Any way to to this?

4

1 回答 1

3

创建一个新的 Firefox 配置文件“sslProfile”。请参阅您的操作系统的 Firefox 帮助。

在您的硒代码中:

ProfilesIni prof = new ProfilesIni()                
FirefoxProfile foxProfile= prof.getProfile ("sslProfile")

foxProfile.setAcceptUntrustedCertificates(true) 
foxProfile.setAssumeUntrustedCertificateIssuer(false)

WebDriver driver = new FirefoxDriver (foxProfile) 
于 2016-10-30T01:16:50.057 回答