Presionar la tecla ESC a través de la clase robort para cerrar la ventana emergente no funciona en Chrome 31 y Firefox 26

I work on selenium automation, we recently updated our selenium jars to latest selenium version and also updated firefox and chrome to latest,

we have one usecase where on clicking on the ESC key we can close the pop-up. But the key pressing doesn't works in both the browser.

preguntado el 27 de noviembre de 13 a las 07:11

1 Respuestas

are u sure clicking ESC button Manually closes POPUP????

if robot class fails try this

driver.findElement(By.name("LOCATOR")).sendKeys(Keys.ESC);

Robot class is far better than using SendKeys

                          (OR)

if it is an alert box try this code you can handle POPUP by using this

   try{
            Alert alert = driver.switchTo().alert();
            alert.accept();

    }
    catch(NoAlertPresentException e)
    {
        /****/
    }

Espero que te ayude

-Ajay

respondido 27 nov., 13:12

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.