Selenium to complete a form of a pop-up window in JAVA

0

Good morning friends, I'm doing the automation of an application, the problem is that the application seems to be developed using Javascript,

I have the problem that I click on the "Add" button and it opens a pop up of a form ... but I can not complete that form I do not know why,

The rest I already did using the FindElement (By.xpath ("name")); But when I enter the pop-up window to fill out the form, I do not fill in the fields,

Does someone help me?

thanks!

    
asked by BlackWidow 05.05.2017 в 16:04
source

1 answer

1

To handle different windows or pop-ups you can use the getWindowHandles() method to get the list of windows and the switchTo().window("idDeTuVentana") method to move between them.

Here you have a pretty good example that I have used several times and I have obtained the answer to How to handle Pop-up in Selenium WebDriver using Java from LINGS :

String parentWindowHandler = driver.getWindowHandle(); // Almacena tu ventana actual
String subWindowHandler = null;

Set<String> handles = driver.getWindowHandles(); // Obten todas las ventana abiertas
Iterator<String> iterator = handles.iterator();
while (iterator.hasNext()){
    subWindowHandler = iterator.next();
}
driver.switchTo().window(subWindowHandler); // Cámbiate a la ultima ventana (tu pop-up)

// Aquí rellena la información referente a tu pop-up

driver.switchTo().window(parentWindowHandler);  // Vuelve a tu ventana principal (si lo necesitas)
    
answered by 01.07.2017 в 10:59