Preciso automatizar o seguinte teste: após o login na página da web, uma nova janela pop-up (com aplicativo) é aberta e todas as etapas devem ser feitas nessa nova janela.
Pergunta: como codificar para alternar da janela de login atual para a nova janela pop-up?
Obrigado!
Se você deseja manipular a janela filho, use as alças em selênio, consulte o código abaixo:
String parentWindowHandle = driver.getWindowHandle(); // get the current window handle
//Perform action on your parent window
//Perform clcik() action on your parent window that opens a new window
for (String winHandle : driver.getWindowHandles()) {
if(!winHandle.equals(parentWindowHandle))
{
driver.switchTo().window(winHandle); // Here yor switching control to child window so that you can perform action on child window
System.out.println("Title of the new window: " +
driver.getTitle());
//code to do something on new window
System.out.println("Closing the new window...");
driver.close();
}
}
driver.switchTo().window(parentWindowHandle);
System.out.println("Parent window URL: " + driver.getCurrentUrl());
Este artigo é coletado da Internet.
Se houver alguma infração, entre em [email protected] Delete.
deixe-me dizer algumas palavras