I'm having trouble detecting if a pop up is shown on an native android app. The scenario is the following:
I start a ticket and I start adding products, but sometimes when I add a product I get an error message saying I can't add that product (which is correct). The thing is, that every time I try to add a product I need to check if that error is shown. And here are the things I've tried so far:
private boolean checkErrorInesperado() {
try {
//clicks on desired element
utils.click(EMicroposVentanasErrores.BOTON_ACEPTAR);
return true;
} catch (NoSuchElementException ex) {
//do nothing it's expected
return false;
}
}
private boolean isElementPresent() {
return (driver.findElements(By.id("foo")).size() > 0) ? true : false;
}
But none of the above are working when i run the test, sometimes it gets stuck validating. Any help would be appreciated.