1

I'm new to Selenium (for C#), and I have the following problem: I want to navigate to a specific URL that, IMMEDIATELY after having loaded the page, shows the classic confirmation window for a certificate.

I hoped the following code would have solved the issue, but it is not true: infact until the confirmation window exists the code does not proceed (and so it stucks at i.Navigate...)

IWebDriver i = new InternetExplorerDriver(pathDriver);
i.Url = urlToBeLoaded;
i.Navigate();  // it stucks here!
i.SwitchTo().Alert().Accept();

If I don't manually accept the certificate the code does not continue with i.SwitchTo()... but under this condition the Accept is obviously completely useless!

Does someone know a way to solve this problem?

At Selenium can't deal with Confirm Certificate popup in IE someone suggested to disable pop-ups, but according to me it would be preferable to solve the problem...

aegon
  • 11
  • 5
  • I believe this is the answer that you're looking for: http://stackoverflow.com/questions/24507078/how-to-deal-with-certificates-using-selenium I've solved this in the past by adding the option to the webdriver profile. Every language and driver are different. – Michiel Bugher May 10 '17 at 20:18
  • You could also check this answer, if you don't want to mess with the driver profile: http://stackoverflow.com/questions/7710619/selenium-2-webdriver-and-ie-9-security-certificate – Michiel Bugher May 10 '17 at 20:20
  • @Michiel Bugher thank you very much for your answers but the problem stil exists: despite for DesiredCapabilities and key, Explorer still shows "Confirm Certificate", that stucks the program at i.Navigate(). It would not be a problem if it were shown in other following pages (I can roughly manage it with SendKeys.SendWait("{TAB}") and so on...), but in this way I'm blocked in an instruction... – aegon May 11 '17 at 10:35
  • At the end I've solved this problem by disabling from Explorer the pop-ups for certificates (it is not an elegant solution but however...); if I solved the problem in the future by means of C# feaures I'll post the solution right here. – aegon May 11 '17 at 12:11

0 Answers0