uipathuipath-studiouipath-robot

UiPath Get Text crashes robot


I'm trying to get a text from a textfield with Get Text, but in some cases this field is optional and the robot crashes because it doesn't have anything in the field.


Solution

  • You have multiple options. It's hard to say which one fits best you so here is a pool of possible solutions:

    1. when NOT using the Modern Design, you can easily use the Element exists activity, self explaining

    2. if you use the Modern Design and miss old activities like Element exists, go to the filter dropdown and select Show Classic, this way you are now also able to choose Element exists

      Activities filter

    3. you could also wrap such failing activities into a Try Catch, then your process wont fail, but a Try Catch should always be the last way out

    4. when using the Modern Design, you can try Find Element, if the returned object is empty you know that it was not found, make sure to set a proper Timeout here, otherwise you wait for 30 seconds

    5. but on your case it could be better to use an Image exists or Find Image Matches as you said you are looking for text in a textfield, just inverse it and look for an empty textfield, and if you have no matches all is fine

    But to be honest, I would go for the Element exists. Give this a try, but be aware that in the future this activity might be replaced by something else and your process will need a little bit of rework.