English 中文(简体)
十二、二、二、九、九
原标题:Selenium 2 Webdriver and IE 9 Security Certificate

I have some Selenium 2 Webdriver test cases for Firefox and Internet Explorer 9. When I access https URLs on IE9 (Windows 7 64bit) I get "There is a problem with this website s security certificate". At this point the test hangs and eventually fails. I tried:

  • Getting Selenium to click on the "Continue to this website (not recommended)." link. This can t be done as this error page is not your usual page. Same with JavaScript - it doesn t execute.
  • I tried adding the registry key
    HKEY_LOCAL_MACHINESOFTWAREMicrosoftInternet ExplorerMAINFeatureControlFEATURE_ERROR_PAGE_BYPASS_ZONE_CHECK_FOR_HTTPS_KB954312
    that prevents the certificate-error-page from displaying - didn t work. Probably because I m on Windows 7 with IE9.
  • Following this advice I tried using browsermob proxy, but there s very little documentation out there and I couldn t work it out.
  • 最后,我没有行政渠道接触我的《刑法》——例如,没有团体政策。 页: 1 我所有安全区都能够在因特网选择中实现,如果我对其他URLs(http://www.un.org)进行测试,则不存在问题。

    Has anyone got a solution to this problem? Does anyone now hot to use browsermob proxy (or any other proxy) effectively to overcome this issue?

    Thanks, Damo

    最佳回答

    I found the answer on the SQA board: https://sqa.stackexchange.com/questions/1928/selenium-2-webdriver-and-ie-9-security-certificate

    我们建立了一个证书,它像一个药店一样工作。

    问题回答

    Okay I刚刚开始使用C#和以下代码,根据IE9开展工作:

    IWebDriver driver = new InternetExplorerDriver();
    driver.Url(YOUR_URL);
    driver.Navigate().GoToUrl("javascript:document.getElementById( overridelink ).click()");
    

    现在,它将进入预定的网页。 对 Java而言,它简单明了:

    WebDriver driver = new InternetExplorerDriver();
    driver.get(YOUR_URL);
    driver.get("javascript:document.getElementById( overridelink ).click();");
    

    采用代谢约束:

    #region SSL workaround for IE
    if "Certificate Error" in driver.title:
        driver.get("javascript:document.getElementById( overridelink ).click();")
    

    这对我来说是过去的工作,给我一个尝试,

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);      
    Webdriver driver = new InternetExplorerDriver(capabilities);
    

    Any progess in this? I m trying to do this capabilities thing... but I don t know how to do it using Ruby :(

    在幼年,情况很简单,因为你可以使用开关:

    nav=Selenium::WebDriver.for(:chrome, :switches => %w[--ignore-certificate-errors -])
    

    或许可以通过开关为电离层电离层电离层电离层电离层电离层。

    如果你使用IE驾驶员,则有一个更为简单的解决办法,载于reply。 附加的好处是,您不必成为网站所有者,而您不必与浏览器或登记处或任何其他低级技术混在一起。

    我们可以使用以下法典。

    wait =new WebDriverWait(webdriver, 10);
    
    webdriver.get(url);
    WebElement ele =wait.until(ExpectedConditions.elementToBeClickable(
                   webdriver.findElement(By.linkText("Continue to this website (not  
                   recommended)."))));
     ele.click();
    

    其他答复有正确的想法,但在实践中却失败,因为<条码>网络驱动器在证书错误网页上贴上斜体。 正确执行应当等到一旁。

    new WebDriverWait(driver, 10).until(ExpectedConditions.titleContains("Certificate"));
    
    
    driver.navigate().to("javascript:document.getElementById( overridelink ).click()");
    




    相关问题
    How to check if an element is visible with WebDriver

    With WebDriver from Selenium 2.0a2 I am having trouble checking if an element is visible. WebDriver.findElement returns a WebElement, which unfortunately doesn t offer an isVisible method. I can go ...

    How do I change the default request timeout for Selenium 2?

    I am currently using Selenium 2.0a2 in Java to access the Internet using an HtmlUnitDriver instance. The problem I am facing is that, when I attempt to access slow websites, the request times out. How ...

    WebRat+Selenium WebDriver: wait for ajax to be completed

    We are running Webrat with Selenium2.0 aka WebDriver in our application. WebDriver handles page reloading very well and do not start next steps if the browser is reloading entire page. The problem is ...

    How to delete Firefox cookies from webdriver in python?

    when I can t delete FF cookies from webdriver. When I use the .delete_all_cookies method, it returns None. And when I try to get_cookies, I get the following error: webdriver_common.exceptions....

    How to change firefox proxy from webdriver?

    how can I access Firefox proxy settings from Python Webdriver and change them to make Firefox use modified proxy settings without needing to restart it?

    热门标签