Handling untrusted SSL certificates in different browsers using Selenium

0 votes
Jun 3, 2019 in Selenium by Ishita
6,205 views

2 answers to this question.

+1 vote
Best answer

Hi Ishita, you can handle untrusted SSL certificates in different browsers by using these code snippets:

  1. In Chrome Browser:

    •  // Create object of DesiredCapabilities class
      DesiredCapabilities cap=DesiredCapabilities.chrome();
      
      // Set ACCEPT_SSL_CERTS  variable to true
      cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
      
      // Set the driver path
      System.setProperty("webdriver.chrome.driver","Chrome driver path");
      
      // Open browser with capability
      WebDriver driver=new ChromeDriver(cap);
  2. In Internet Explorer:

    • // Create object of DesiredCapabilities class
      
      DesiredCapabilities cap=DesiredCapabilities.internetExplorer();
      
      // Set ACCEPT_SSL_CERTS  variable to true
      cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
      
      // Set the driver path
      System.setProperty("webdriver.ie.driver","IE driver path");
      
      // Open browser with capability
      WebDriver driver=newInternetExplorerDriver(cap);
  3. In Safari:

    • // Create object of DesiredCapabilities class
      
      DesiredCapabilities cap=DesiredCapabilities.safari();
      
      // Set ACCEPT_SSL_CERTS  variable to true
      cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
      
      // Set the driver path
      System.setProperty("webdriver.safari.driver","Safari driver path");
      
      // Open browser with capability
      WebDriver driver=new SafariDriver(cap);
answered Jun 4, 2019 by Abha
• 28,140 points

selected Jul 8, 2019 by Abha

Hi, help me, Already implement untrusted SSL certificates for  Chrome Browser, but continues failed. 

Someone, Who can guide me for the solution?

Thanks,

Hey @catalina, Have you tried Abha's solution for chrome browser? What is the error you are facing?
0 votes

Hey Ishita, you can also handle SSL certificate for Firefox by using follow lines of code:

FirefoxProfile profile=new FirefoxProfile();

profile.setAcceptUntrustedCertificates(true);

WebDriver driver=new FirefoxDriver(profile);

driver.get("www.123movies.sc");
answered Jul 8, 2019 by Anvi
• 14,150 points
We dont have FirefoxDriver(FirefoxProfile) constructor

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

Handling pop up in Chrome using Selenium WebDriver

AutoIt Window Information Tool do not recognize ...READ MORE

answered Jun 11, 2018 in Selenium by Meci Matt
• 9,460 points
2,889 views
0 votes
1 answer

How can I refresh a browser window in different ways using Selenium Webdriver?

Hello Piyush, you can refresh a browser ...READ MORE

answered May 29, 2019 in Selenium by Anvi
• 14,150 points
3,238 views
+1 vote
1 answer

In selenium Can we interact with browsers directly without using browsers web drivers like codedui

As per my understanding of your query, ...READ MORE

answered Aug 20, 2020 in Selenium by Sirajul
• 59,230 points
1,167 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,674 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,143 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
0 votes
1 answer
0 votes
2 answers

How can we take screenshots of tests in Selenium 2 using C#

Hey, try using following code command to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,140 points
1,434 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP