SSL Certificate in Selenium

Let’s see, How can you handle SSL certificate in Selenium. When we access HTTPS websites, Sometimes we face untrusted certificate issues. This issue comes in all browsers like IE, Chrome, and Firefox as well. These certificates are called untrusted certificates.


Why we get these certificates issues?

Actually, Each secure site has Certificate so its certificate is not valid up-to-date. The possibilities for this issue could be –

  1. The certificate has been expired on the date.

  2. Certificate is only valid for (site name)

  3. The certificate is not trusted because the issuer certificate is unknown due to many reasons.


Handle SSL Certificate Error in Firefox

  1. Create Firefox profile.(We have seen this “Create Firefox profile“)
  2. We have some predefined method in Selenium called setAcceptUntrustedCertificates() which accept Boolean values(true/false)- so we will make it true.
  3. Open Firefox browser with the above-created profile.


Handle untrusted certificates in Chrome

To handle certificates errors in chrome, we will use the concept of desired capabilities.
Using DesiredCapabilities, we can set and configure webdriver browser driver Instance settings before launching It.


Simplest example Is -> I wants to set proxy settings for my webdriver browser Instance. I can do It using DesiredCapabilities


Handle SSL issue in IE

Same like Chrome, we can handle the SSL issue in IE browser. Look at the below code.


So this is the, How can handle the SSL certificates or untrusted certificate issues. If you have any query, any question please feel free and write us. We will help you to make selenium easier.

0 Comment

Leave a Reply