Doctor Who
Doctor Who

Reputation: 1659

Selenium Webdriver: Suppressing untrusted connection message in firefox

I've using selenium webdriver with firefox but I don't know if its due to firefox updating yesterday or something changing on the site but now everytime the driver opens the page I get the untrusted connection page in firefox so I would have to manually add the exception.

I cannot give access to the site for others to test because it is an internal site that we are creating but the message in firefox is:

TestingSite uses an invalid security certificate. The certificate is not trusted because no issuer chain was provided. (Error code: sec_error_unknown_issuer)

In my tests I create a new firefox profile and set these two values:

f.setAcceptUntrustedCertificates(true);
f.setAssumeUntrustedCertificateIssuer(false);

I read about setting these on other posts where people were having a similar problem and it seemed to have worked for the past few months but now I am getting the exception again, but only on this one site.

Upvotes: 2

Views: 3748

Answers (2)

Charlie MAI
Charlie MAI

Reputation: 93

I got this issue as well using selenium 3.0.0 Beta2 with ff48.0.1 All the "API-way" I've tried are failed, but I got a workable way to solve this issue:

Step 1 - Open your FF manually and accept the self-signed certificate manually (I mean accept "sec_error_unknown_issuer" security exception)

Step 2 - Locate your FF's profile directory and copy the path of the your profile directory, ex(MAC env): "/Users/UserABC/Library/Application Support/Firefox/Profiles/vndms5adearwtry.default"

Step 3 - In your selenium java code, use the following way to init the FirefoxDriver:

FirefoxProfile firefoxProfile = new FirefoxProfile(new File("/Users/UserABC/Library/Application Support/Firefox/Profiles/vndms5adearwtry.default"));
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
FirefoxDriver driver = new FirefoxDriver(capabilities);

Then that's it. You can access the website with self-signed certificate using selenium code right now. The whole idea is not use the selenium-API, but use the FF's profile which is already accept "sec_error_unknown_issuer" exception directly. That's the way I solve this issue, hope it can help anyone.

Upvotes: 2

DavidA
DavidA

Reputation: 4184

I had the same problem, but simply updated to selenium 2.35.0 like User2239784 said, and it works fine again.

Upvotes: 0

Related Questions