Multiple attribute in selector using OR operator

Hi Community,

Recently I came across an automation problem. I am using element exist activity using aaname to detect a text. Now in some cases with aaname its not able detect element but with visible innertext its able to detect.

Is there any way we can use put both and if value matches with either aaname or visible innertext then element exist returns true value.


1 Like

In element exists activity you will get to see a property called WAITFORREADY
choose as Complete so that it waits for the element to be loaded that includes visibility as well

in terms of selector if you want to have both a simple workaround would be like this

Use a TRY CATCH activity and in TRY block keep your element exists activity which has aaname as attribute
if that works fine
if that fails it goes to CATCH block where keep a element exists activity innertext as attribute

Hope this helps
Cheers @Akshat_Sharma1

1 Like

Thank you so much for the suggestion. But is there any way we can add both innertext and aaname in one selector?

is it always detected within the innertext attribute?

not necessarily. That is why i was thinking if there is someway we can keep both attributes in selectors using OR operator.

kindly note: we have a limited insight, so we ask.

Would it be always reliable be present (that why we asked) then the selector can be configured to use only the innertext attribute and we can ommit aaname

For a defensive approach Palani gave you a pattern
Another one is about get attribute analysis for the element retrieval along with some other techniques

In an experimental way we could try to simulate an or by using regex selectors at both attributes