Checking for not found

I have a “FindElement” statement that assigns Output to uie_WeDontKnow.
I’m expecting the element to not be found often. what would be the syntax to check that uie_WeDontKnow was not set and the item was not found?
Similarly how do I clear it before execution so that doesn’t have a residual value from a previously executed iteration?

Hi @chuck.jowett,

Find element will fail if the element is not found. To check if the element is found please use “Element Exists” or “Check App state” activity

Element Exits doesn’t seem to be supported only CV Element Exists which is looking for a visual object - not really what I want.
I know Find Element will fail, my question is how do I check whether or not it did, assuming ContinueOnError is True? I could put the Find Element in a Try Catch but the activities to be done aren’t when it fails but when it doesn’t. I could set a bolean to True in the catch but that seems like the backwards way of doing it if I can just test something after the execution

Hi @chuck.jowett,

“Element exists” is a activity which is in classic design. To enable you will have to choose filter icon enable show classic
Similar activity in modern design would be “Check App State”
While using Find element you will have add additional steps to check if the element exits , but with the above two it is just one activity
For using find element for the same purpose you will have to add Find element in try catch , Assign the Boolean variable as False before try catch and in catch section you have to assign it to true. In this way you will be able find if element appeared or not.
To achieve the above continue on Error should be False

Hi @chuck.jowett ,

Maybe you could try Setting the Find Element Output variable as Nothing before the Activity, In this way, even after the run if the variable is Nothing, then it means that there was no element found.

Setting the variable using Assign Activity :

uie_WeDontKnow = Nothing

After the Find Element Activity, Checking whether it has a Value using If Condition :

Let us know if this works out.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.