Selenium 2 Webdriver e IE 9 Certificado de Seguridad


Tengo algunos casos de prueba de Selenium 2 Webdriver para Firefox e Internet Explorer 9. Cuando acceso a URL https en IE9 (Windows 7 64bit) obtengo "Hay un problema con el certificado de seguridad de este sitio web". En este punto, la prueba se cuelga y finalmente falla. Lo intenté:

  • Conseguir Selenio para hacer clic en el "Continuar a este sitio web (no se recomienda)." enlace. Esto no se puede hacer ya que esta página de error no es su página habitual. Mismo con JavaScript no se ejecuta.
  • he intentado añadir el clave del registro
    HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Internet Explorer \ MAIN \ FeatureControl \ FEATURE_ERROR_PAGE_BYPASS_ZONE_CHECK_FOR_HTTPS_KB954312
    esto evita que se muestre la página certificate-error-page - didn't work. Probablemente porque estoy en Windows 7 con IE9.
  • Siguiendo este consejo Intenté usar browsermob proxy, pero hay muy poca documentación por ahí y no pude resolverlo.
  • Finalmente, no tengo acceso de administrador a mi PC, por ejemplo, no acceso a directivas de grupo. Selenium 2 Webdriver funciona bien en Firefox. Tengo todas las zonas de seguridad habilitadas en IE Internet Options y si corro las pruebas en otras URLs (http) entonces no hay problema.

    ¿Alguien tiene una solución a este problema? ¿Alguien ahora caliente para utilizar browsermob proxy (o cualquier otro proxy) con eficacia para superar este problema?

    Gracias, Damo

    Author: damo_inc, 2011-10-10

    8 answers

    Bien, acabo de hacerlo funcionar bajo IE9 usando C# y el siguiente código:

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

    Y ahora irá a la página prevista. Para Java es tan simple como:

    WebDriver driver = new InternetExplorerDriver();
    driver.get(YOUR_URL);
    driver.get("javascript:document.getElementById('overridelink').click();");
    
     26
    Author: Nyegaard,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2012-08-02 15:39:35

    Usando los enlaces Selenium-Python:

    #region SSL workaround for IE
    if "Certificate Error" in driver.title:
        driver.get("javascript:document.getElementById('overridelink').click();")
    
     4
    Author: lacy,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2014-09-02 19:47:00

    Encontré la respuesta en el tablero de SQA: https://sqa.stackexchange.com/questions/1928/selenium-2-webdriver-and-ie-9-security-certificate

    Creamos un certificado y funcionó como un encanto.

     3
    Author: damo_inc,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2017-04-13 12:41:46

    Esto funcionó para mí en el pasado, darle una oportunidad,

    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);      
    Webdriver driver = new InternetExplorerDriver(capabilities);
    
     2
    Author: nilesh,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2011-10-12 02:06:23

    ¿Algún progreso en esto? Estoy tratando de hacer esto de las capacidades... pero no se como hacerlo usando Ruby: (

    En chrome es simple ya que se pueden utilizar los interruptores:

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

    Tal vez sea posible hacerlo para IE usando switches

     0
    Author: Mario,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2012-05-30 23:32:59

    Hay una solución mucho más simple en caso de que utilice el controlador IE, documentado en esta respuesta. El beneficio adicional es que no tiene que ser el propietario del sitio y no tiene que enredarse con browsermob o el registro o cualquier otra tecnología de bajo nivel

     0
    Author: Michael Bahig,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2017-05-23 12:25:39

    Podemos usar el siguiente código.

    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();
    
     0
    Author: Vijaya Kumar Govindholla,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2014-08-19 10:21:58

    Las otras respuestas tienen la idea correcta, pero fallan en la práctica porque WebDriver no navega inmediatamente a la página de error del certificado. La implementación correcta debe esperar un poco.

    new WebDriverWait(driver, 10).until(ExpectedConditions.titleContains("Certificate"));
    
    
    driver.navigate().to("javascript:document.getElementById('overridelink').click()");
    
     0
    Author: Cord Rehn,
    Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
    2016-06-13 17:29:15