0
I am testing a piece of my application, so I created the following method to check if the element exists on the page:
public boolean existe(){
try{
driver.findElement(elemento);
return true;
}
catch(NoSuchElementException e){
return false;
}
}
But I need to leave a timeout of Lenium configured in 60 seconds, IE, the instance waits up to 1 minute to find the element, if not find cause the exception and the treatment returns false
. So I tried this way:
public boolean existe(){
if(!driver.findElements(elemento).isEmpty()){
return true;
}else{
return false;
}
}
Still the check takes place for one minute even with the screen loaded. I’m trying to develop a way to search for the element and if it doesn’t exist at that moment it returns false. This way I control the load in the test and as soon as loaded the page makes the check.