Hi.
To find if an element is present or not I use this script :
function get(page, value, presence = true, scroll = true) {
const pageElement = utils.getPage(page);
Options.Run.Timeout = 50;
optimisation.stopLog();
const elementHTML = pageElement.FindElement(value);
optimisation.startLog();
Options.Run.Timeout = 4000;
if(presence && elementHTML.Exists) {
elementHTML.scrollIntoView(scroll);
Log.Message("On a trouvé l'élément :" + value);
return true;
}else if(!presence && !elementHTML.Exists) {
Log.Message("On a pas trouvé: " + value);
return true;
}else{
Log.Error(`On a ${presence ? "pas " : ""}trouvé: ${value}`);
return false;
}
}
stopLog and startLog are important here, because when TC didn't find the object, it return an error. But this error is expected if we want to not find the object. (in my case, I don't want to log this error).