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é:
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.
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
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();");
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();")
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.
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);
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
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
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();
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()");
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