Meta :-
Steps to reproduce :-
WebDriver driver = new FirefoxDriver();
driver.get("untrusted/self-signed URL")
Stacktrace :-
org.openqa.selenium.WebDriverException: Reached error page: about:certerror?e=nssBadCert&u=xxxxxxxx&c=UTF-8&f=regular&d=xxxxxx%20uses%20an%20invalid%20security%20certificate.%0A%0AThe%20certificate%20is%20not%20trusted%20because%20it%20is%20self-signed.%0AThe%20certificate%20is%20not%20valid%20for%20the%20name%20xxxxxx%0A%0AError%20code%3A%20%3Ca%20id%3D%22errorCode%22%20title%3D%22SEC_ERROR_UNKNOWN_ISSUER%22%3ESEC_ERROR_UNKNOWN_ISSUER%3C/a%3E%0A Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' System info: host: 'Saurabh-PC', ip: '192.168.3.8', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_71' Driver info: org.openqa.selenium.firefox.FirefoxDriver
Screenshot :-
I have also tried using FirefoxProfile
as :-
DesiredCapabilities dc = DesiredCapabilities.firefox();
dc.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
FirefoxProfile profile = new FirefoxProfile();
profile.setAcceptUntrustedCertificates(true);
dc.setCapability(FirefoxDriver.PROFILE, profile);
WebDriver driver = new FirefoxDriver(dc);
driver.get("untrusted/self-signed URL");
But issue is the same as above.
Reference Link which have tried :-
According to this bug Support for untrusted/self-signed certificates has been added via bug 1103196 and will be available starting with Firefox 52
.
But I could not find any solution for Firefox v51.0.1 (32-bit)
.
Is there any way to solve this issue using Firefox v51.0.1 (32-bit)
?
As in this bug mentioned Support for untrusted/self-signed certificates will be available starting with Firefox 52
, we need to wait until Firefox 52
is not released.
Solution :-
For now, as alternate solution we need to use existing Firefox profile
where the certificate for untrusted/self-signed URL is already added into Firefox's exception list
.
How to create custom Firefox profile for selenium?
Launch Firefox using existing profile as :-
System.setProperty("webdriver.gecko.driver", "path/to/geckodriver")
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("created Profile Name");
WebDriver driver = new FirefoxDriver(myprofile);
driver.get("untrusted/self-signed URL");