What are the best approaches to validate web forms with inline message

Hi, I’m trying to validate one web form which prints inline error message, so I am doing screen scraping and checking whether that message is available on page, but when we enter correct data then this message doesn’t print so its trying to looking for element (error message) which I need to scrap and it throws error, so I already surrounded this scrapping code in “try catch” but problem is in success scenario script taking time.

So I would like know better approach to handle this type of validation

To understand this please see screenshot, here I am trying to check whether correct email is entered or not, here I am able to check it through screen scrapping of error message element after pressing next button but its taking time when email is correct.

Perhaps set a delay?

Delay will not make sense here, as currently its auto Delay (i.e. script is taking time to find that element in try-catch and after that it starts further execution)

I’ve some manual interaction after this step, so my problem is during delay (or wait time) person seating in-front of system thinks that robot is stuck so he is trying to click on next button then after further script fails, as person has disturbed flow.

You should decrease the TimeoutMS property to 3000, let’s say. By default UiPath searches for an element for 30 secs.

1 Like

To not have the exception (logging in succesfully is hardly exceptional, at least hopefully :slight_smile: ) you could change FindElement to ElementExists and then act on it’s boolean result.

As for the delay, you can always change the TimeoutMS (Timeout in miliseconds) on the activities. You might notice that by default FindElement has TimeoutMS empty, which defaults to 30000 (30s), while ElementExists is by default set to 3000 (3s).

Thanks @badita - I’ve set “TimeoutMS” property to less than 30 second and it worked

Thanks @andrzej.kniola - ElementExists is good option rather than exception, I will check it soon.