Handle SSL untrusted certificate error message using Selenium

In the previous tutorial discussed the technique to find all the broken links of any website. Today we will talk about the website’s trust and security which is determined by the Certificate Authority. In short, we call the CA enabled. Our agenda for this tutorial is about handling SSL untrusted certificate error message through Selenium. We also call it handling SSL certificate message through Selenium.

Why do we get SSL Untrusted certificate error message?

We get SSL untrusted certificate error message when webmaster changes the URL protocol from http:// to https:// and he forgot to configure the CA certificate on its server. When any browser fetches URL with https prefix then it tries to find out SSL certificate installed file on its server. If it does not get any CA certificate or the certificate is self-signed (not signed by any authority body) then it throws SSL untrusted certificate error message.

Hope it clears your confusion. 😊

Free Advice: Either you fully implement https or keep http only.

What is a Secure Socket Layer certificate?

In short, we call Secure Socket Layer as SSL. It is the secured HTTP protocol (HTTPS) which establishes a secured connection between the server and the client (browser). Installation of SSL certificate ensures the secure and safe browsing of the web page and it is responsible for secured data exchange in encrypted form.

Significances of having an SSL certificate

There are various significances of having an SSL certificate on the site. It gives the advantage to the website in many ways, some are listed as follows:

  • It helps to develop the feeling of trust among the users
  • SSL is the secured way to integrate payment facility on the website. That is why all the e-commerce portals and banking portals have HTTPS. You can validate it by yourself.
  • It attracts more user due to security
  • A website is also secured from the attackers as it restricts Cross Site Scripting and other breaches
  • It helps to establish any business as the authority
  • Overall security observed for users as well as owner

How to get an SSL certificate for the website?

These days web host provider already installs the CA certificate, you only need to enable it on your website. You can reach your hosting provider for the confirmation.

If you do not have pre-installed CA certificate on your server, then you need a CA certificate from the authority. It is paid as well as free. Let’s Encrypt is an online portal which offers free, automated and opened CA certification. Get it and ask your hosting provider to install on your server.

How to handle SSL untrusted certificate error message using Selenium WebDriver?

You got the basic concepts of SSL untrusted certificate. We get different SSL untrusted certificate error message in the different browser. Below image is the compilation of different SSL untrusted certificate error message taken for the different browser.

SSL Untrusted Certificate Error Message

Let’s have a look into the sample codes to handle SSL untrusted certificate error message in Selenium WebDriver.

Handling SSL untrusted certificate error in Chrome

Handling SSL untrusted certificate error in Firefox

Handling SSL untrusted certificate error in Internet Explorer

These are sample code for Chrome, Firefox and Internet Explorer. So, when we need to handle the untrusted certificate error message then we need to call the profile options of the browser. In the above code you see the implementation is similar, but with different calls.

This was all about handling SSL untrusted certificate error message using Selenium WebDriver. You can ask your queries using below comment form and don’t miss to join our Facebook community for more updates on Test automation.

Join Inviul fb group

Leave a Reply