Is it possible to take the result of "Click Image" activity?

I want to how can we extract the result of a “Click Image” activity. If a particular target image is not found then the click is not possible. In this case I want to take the boolean value whether the click occurred or image found or not using a boolean variable.

I know that this can be done in two step process but takes longer time.

Thanks.

Hi,

We can achieve it to use Find Image activity and Click activity as the following steps.

  1. Put Find Image on your workflow and indicate target image.
  2. Set variable (say elm) in Output - FoundElement property as its result.
  3. Put Click activity and set elm variable in Target - Element property.

If target image is not found, exception occurs and you can handle it using try-catch activity.

It takes mostly same time as Click Image does.

Regards,

2 Likes

Hi @Yoichi,

Thanks for your idea. It completely makes sense to me. But,

When I place the find image activity inside the try catch block, it doesn’t catch the “SelectorNotFoundExecption” but it shows error “Activity timeout exceeded” and stops.

Am I missing something here?

Hi,

Find Image (and Find Element) returns “Activity timeout exceeded” if Robot cannot find target element in time. Thus, please catch by "UiPath.Core.Activities.ActivityTimeoutException".

Or, we can also use ContinueOnError property in Find Image. If set true, exception does not occur and judge if it’s found by whether FoundElement has value or not.

Regards,

1 Like

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