How to handle UiElement.FindFirst() not found without try catch

Hi,

I have UiElement collection, then I am looping it and trying to findFirst element with specific selector, but if it is not found iam getting error… TryCatch is taking too long to fire (30s+)…
item as UiElement, variable1 as IvariableResolver and its empty…

my clause:
item.FindFirst(FindScope.FIND_CHILDREN,new Selector(“<webctrl tag=‘p’ class=‘mb1’ innerHtml=‘fa fa-file-text-o’ />”),variable1).Get(“innerText”).ToString

By the way what is IvariableResolver without it uipath did not let me start process as it was mandatory…

Thanks.

What about checking e.g. with a Count statement (can be done in LINQ as well) if the item is available and then fetch it or go into error handling

Thanks for suggestion, but could you be more specific? I tried switcing to UiElement.FindAll().count(), but still it results in Selector Not found error…

Please give us some screenshots and some details on your flow, task to achieve.

I have UiElement collection, then I am looping it and trying to findFirst element with specific selector

This line is a little bit unclear. So we can give you a better help

I think i found work around.

I used built in FindChildren activity to pass UiElement collected from previous Collection as it has ContinueOnError feature and then I am getting desired result, do not know if that is correct way to go but it works…

Second screenshot due to limit

image

Change the Timeout to a lower number:

May Element exists can enhance your implementation. Was there any reason that you was using this activity?

This statement was for actual Try Catch activity block there is no timeout timer…

Now FindChildren set ContinueOnError to true is instant even with default timeout value.

Thanks again

There should be a ContinueOnError attribute. If you set that to True it may continue on, but the child element would be NULL. And based on this, you can take a decision on what the process must do next.