Issues with handling SSL certiicates on Chrome, IE and Opera

826 views Asked by At

As the title says it, I'm struggling with handling the SSL certificates in Chrome, IE and Opera browsers. What I'm doing:

ChromeOptions opt = new ChromeOptions();
opt.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true);

IWebDriver driver = new ChromeDriver(opt);
driver.Navigate().GoToUrl("https://localhost");

What I'm getting:

Result StackTrace:  
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
   at ...  (project name and path here)
Result Message: Initialization method <Project and test method name here> threw exception. System.InvalidOperationException: System.InvalidOperationException: unknown error: cannot parse capability: chromeOptions
from unknown error: unrecognized chrome option: acceptSslCerts
  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64).

Similarly, I'm getting the same thing for Opera browser by using OperaOptions and OperaDriver classes:

System.InvalidOperationException: unknown error: cannot parse capability: operaOptions
from unknown error: unrecognized chrome option: acceptSslCerts

And for Internet Explorer browser, by using InternetExplorerOptions and InternetExplorerDriver classes, I'm not getting any errors, but the SSL Certificate is not handled properly.

Any help is appreciated.

1

There are 1 answers

0
Mrunal Gosar On

Few things I am assuming you've already set chromedriver executable property. I would suggest you to try this out as below:

DesiredCapabilities capability = DesiredCapabilities.chrome();
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new ChromeDriver(capability);