Handle non-trusted connection in Selenium WebDriver
A trusted SSL certificate helps to validate the authenticity of the website. In case it doesn’t, you will get an error message from your browser for “non-trusted connection”. An Untrusted SSL certificate may be a threat for data security. There could be many reasons for the browser to reject a certificate, resulting in an non-truested connection. few of such causes:
sec_error_expired_issuer_certificate
This error usually appears when your system shows a wrong date. It can be fixed by setting the system clock to current date.
sec_error_expired_certificate
You will get this error in case of expiration of website identity certification. In addition, incorrect system date could also be the reason. You can fix this by setting the system clock to current date.
ssl_error_bad_cert_domain
The error indicates that the identification received by you is intended for another site.
Handling SSL Untrusted Connection in Selenium WebDriver
Let’s consider the Firefox browser to create a new profile and set the following:
- ‘setAcceptUntrustedCertificates’: true
- ‘setAssumeUntrustedCertificateIssuer’ : false
//Creating new Firefox profile
FirefoxProfile profile = new FirefoxProfile ();
profile.setAcceptUntrustedCertificates (true);
profile.setAssumeUntrustedCertificateIssuer (false); driver =
new FirefoxDriver (profile); driver.manage ().window ().maximize();
0 comments