How to Detect All Field Validation Errors in UiPath

Hello everyone,

I’m currently working on this application. Is there a way to use a single Check App State activity to handle all the red messages displayed below the fields? If you know of any method to achieve this, I would really appreciate your help.

Thank you in advance.

Hello @Ben.Zineb,

Yes you can " Check app state" for all red message (erros)

The best approach is to create a dynamic or generic selector that can identify any of the red message elements, regardless of which field triggered it

You can use Wildcards or regex in Selectors

  1. Indicate one of the red messages as the target.
  2. In Selector Editor, identify the attribute that defines the red message (e.g., class='error-message', tag='SPAN', css-selector, etc.).
  3. Remove specific attributes that make the message unique to one field (like idx or unique id values) and replace them with wildcards (*)

Thank you for your response. Could you please help me further?
Thank you in advance.

I’m sharing what I’ve done, along with the result I get when I highlight it.


Yes, you got it. If we make CSS-selector as wildcard and idx as 1 ( it will just match with first red message element found, we can use this element in our check app state (element appears)

I assume your goal is to check if there are any errors on any of the fields.

The way to do this is with Find Children. Set it to FIND_DESCENDANTS. Set its selector to an element on the page that contains all the error message UI elements.

Use UI Explorer to find common selector values between all the error messages. For example, maybe they all have the type of error and are SPAN elements. So you would set the filter in the Find Children as

<webctrl type='error' tag='span' />

Create a variable in the output. Now you have an array of all the UI Elements that are error messages. You can now count how many there are, loop through them and use Get Text to get the actual error messages and add them to one consolidated string error message, etc.

Another way to do it that’s a little more modern would be to use For Each UI Element. When you add an element by clicking one of the error messages, it might just automatically pick up all the other error messages and that’s it, you’re done - it will now loop through any of the error messages if they exist. So you could set a boolean errorsExist variable to false just before the For Each UI Element, then inside the FEUIE set it to true indicating that there was at least one error message found by the FEUIE. Or as it loops you could Log Message, concatenate into one combined error message, etc.

One other thing to keep in mind is that those error message elements might exist in the DOM without being visible, so you may need to incorporate visibility checks in your activities.

@Ben.Zineb,

Try to use For Each Element as suggested by @postwick. Alternatively, you can use UiPath Screenplay, It can detect the error , just need to pass the prompt and configure the output arguments.

Thanks