Check if One Element Exists Out of Many Possibilities

Hello, I am trying to find an efficient way to see if one of many possible elements exists on a webpage.

I have a while loop that checks to see if one of 5 elements exists. If none exist, the page refreshes. If one of the elements exist, a message box will pop up.

Currently I have nested if statements which looks very messy and will be hard to manage.
Is there a better way to achieve this?

Have you tried the Pick with Pick Branch activity?
It will allow you to trigger actions, and looks for the triggers in parallel.

Thanks, if I’m not mistaken isn’t this activity used if you want one of multiple outcomes? In this case I just want to use one variable, end the while loop and show the message if element exists is true.
If none of those are found, the page should refresh and check again.

If I can achieve this with Pick Branch can you tell me how?

Hi there @Gabrielle_M,
You could try a Parellel Activity.

The below should explain:

Thanks in advance,

1 Like

Thank you, I tried this a few minutes ago. It looks like even if one of the elements exists, because the others don’t exist the boolean will always return false.

oh wait sorry, I didn’t see the screenshot. I’ll try again.

Hi there @Gabrielle_M,
I can’t seem to replicate this locally.

You may want to double check you have the Parallel Condition Property set to your Boolean, as shown below:

It should then stop searching upon finding any one of the elements, resulting in a True Boolean.

EDIT: No problem, hopefully that fixes it :slight_smile:

Thanks once again,

Good idea. I didn’t realize there was a completion condition on that one.

1 Like

This works perfectly now, thank you so much

1 Like

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