When i run my code everytime pass by login, after fill every field and click on the button, my code validates if the word: “Descubra” of page “Descubra” is displyed:
//Esperando a página: “Descubra Carregar”
WebDriverWait aguardarCarregarPaginaDescubra = new WebDriverWait(driver, 20);
aguardarCarregarPaginaDescubra.until(ExpectedConditions.visibilityOfElementLocated(MobileBy.id(“br.com.vivo:id/toolbar_layout”)));
//Pegando o texto do Descubra
String textoDescubra = driver.findElementById(“br.com.vivo:id/toolbar_layout”).getAttribute(“content-desc”);
//Comparando se o Texto Exibido é o Descubra para validar se o login foi realizado com sucesso
Assert.assertEquals(“Descubra”, textoDescubra);
This page is what my code validates
although, sometimes is displayed a random page,random screen, random modal, and always the validation returns with error, how i can avoid this kind of stuff ?
This is the random page, random modal that is displayed sometimes