0

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?

Andreas Willich
  • 5,665
  • 3
  • 15
  • 22

1 Answers1

0

Currently focused window has been closed.OpenQA.Selenium.NoSuchWindowException: Currently focused window has been closed.

Please check the Required Configuration, and make sure you have configure them.

Result Message: Unable to find element with css selector == [id='invalidcert_mainTitle']

you can check this thread:

rg.openqa.selenium.NoSuchElementException popularly known as NoSuchElementException extends org.openqa.selenium.NotFoundException which is a type of WebDriverException.

NoSuchElementException can be thrown in 2 cases as follows :

  1. When using WebDriver.findElement(By by) :

    //example : WebElement my_element = driver.findElement(By.xpath("//my_xpath"));

  2. When using WebElement.findElement(By by) :

    //example : WebElement my_element = element.findElement(By.xpath("//my_xpath"));

Zhi Lv
  • 18,845
  • 1
  • 19
  • 30