I need help with handling the SSL certificates in IE browser using selenium and C#. I already tried some options, but with no success.
First approach
private static InternetExplorerOptions IeSettings()
{
var options = new InternetExplorerOptions();
options.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true);
options.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, true);
options.IgnoreZoomLevel = true;
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
return options;
}
public static IWebDriver ieDriver = new InternetExplorerDriver(IeSettings());
Using this setting, i open the page and I see: Page is not secure warning and error thrown is:
Currently focused window has been closed.OpenQA.Selenium.NoSuchWindowException: Currently focused window has been closed.
I tried to add there Driver.SwitchTo().Window(Driver.WindowHandles[0]); but same error is present.
Second try
I try to click through the page with warning. If the page is open, click on show more, wait for continue button and then click it (page objects are defined in other class)
public void AcceptCertificate()
{
Driver.Navigate().GoToUrl("page");
if (SSLpageTitle.Displayed)
{
SSLpageMoreInfoButton.Click();
Driver.Wait.Until(x => SSLButtonGoToPage.Displayed);
SSLButtonGoToPage.Click();
}
}
Unlucky for me, i am getting error :
Result Message: Unable to find element with css selector == [id='invalidcert_mainTitle']
i tried different types of CCS selectors, none of them was working. My impresion form IE using selenium is realy bad, and it is getting worst and worst!!!
Any ideas how to get through?