How to handle On element appear

Firstly, I attempted to use the element exists activity then click activity to click on a link.
But if the user does not have the correct access the link is hidden and the robot breaks as it is confirms the link exists but is unable to click on it.

Is it possible to use the ‘On Element Appear’ activity?
How would I handle the exception when it times out as the element does not appear and send an error message instead?

Hi @chend

It seems like you already know how to use ‘On Element Appear’ activity, so I’ll skip that part.

On the exception handling, I’d suggest placing it (or perhaps a sequence of actions) in a try-catch block, so that the program can end smoothly.

Upon catching the exception, there are a few things that can be done:

  1. Retry the action, in case the link doesn’t load in time
  2. End the process, because the user doesn’t have the access anyway.

You could also increase the timeout of the “On Element Appear” activity, so that you lower the chances of scenario (1) happening. It really depends on how you (or the end user) would like the process to continue after that. Hope it helps!

1 Like

Hi , have you checked that waitvisble & waitactive on properties , is it possible to use find element activity

I would suggest to set WaitForReady property to Complete in Click Activity. Click will wait until the page loads completely avoiding clicking inappropriately.

1 Like

Hi Nisa,

Thanks for the advice. It appears to work as per below:


image
image

Does anyone know how to make use of the Output - FoundElement?
Are you able to somehow assign the output to become a boolean variable?

Yes I have.

1 Like

Thanks for the tip.

ok , this may might occurs not also about element exists activity , check the next Click activity properties,

go to there and check “Target” ==> WaitForReady element
change it in to “Interactive or Complete” and try

If you already checked “SimulateClick” try with unchecked

Glad that worked out well for you!

Regarding the second part on the FoundElement, you can pass it as another variable to another activity, when you need to interact with the element eg. click, type into etc. It’s an alternative to the selectors that you usually use.

Adding on, I don’t think assigning a boolean is necessary, because:
If found, ie true → Activity Proceeds to “Do” in the Activity
If not found, ie false → Exception occurs (and hence exception handling)

However, if you reallyyyy want to assign a boolean for other purposes, one way that I can think of immediately, is to Assign a True boolean value within “do” and Assign a False value within the “catch” section.