I am facing a strange issue while typing into an EIN field using Modern UI activities inside a Try/Catch.
Sometimes the Type Into works perfectly, but sometimes UiPath throws this error:
Type Into: Could not find the user-interface (UI) element for this action.
However, when this happens, the workflow does NOT go to the Catch block. Instead, the process stops completely without reaching Catch.
It looks like Modern UI automation is validating the selector before the Try block executes, so the exception is thrown outside Try/Catch.
Because of this:
ContinueOnError = False → workflow stops before Try
ContinueOnError = True → workflow skips error completely but does NOT enter Catch
Try/Catch never gets triggered
I want to understand:
Why does Try/Catch not catch this selector error in Modern UI?
Is UiPath validating selectors before Try starts?
What is the correct best-practice approach to always move control to Catch when Type Into fails?
My goal is simple: If the EIN field is not found or not ready, I want the workflow to enter Catch every time.
Attaching screenshots of the activity and error message:
It should practically not validate before entering the try block. Selectors are not validated before. May be before this you have some condition due to which it is not getting in try block iteself. Can you re-verify the flow.. Can you share a Screenshot of your xaml or the flow, will check and revert.
You should check the element first with activities like Check App State or Element Exists, and only then perform the Type Into. That way, if the field is missing or not ready, the workflow can handle it properly inside Try Catch. The best practice is to always validate the UI element before acting on it so exceptions are managed consistently.