Yesterday, this came to my thoughts, 'Why can’t we have customized exception messages (as one of its properties) at activity level. ’
Example: Consider we have multiple clicks in a XAML with same or similar selector. In case, one of these clicks failed (selector not found,may be). We usually go through logs, find where we used that selector in code, will check screenshots blah blah to figure out where and what went wrong. This consumes quite a time, especially during maintenance phase.
If we have customized(user) error message at activity level, this helps reduce lot more time in debugging.
Please find below my view, if there are suggestions to add try catch,
- Adding try catch for each activity(or for most of the activities) within the same xaml increases the development time.
- It also increases the XAML weight (minimum it can be, but still)
- Most importantly, no one wants to waste time adding try catch for each activity
May not be for all the activities listed under ‘Activities’ tab, but atleast for activities that will be used multiple times, in the same xaml.
Example : Clicks, type into, send hot keys, attribute activities, etc kind of stuff.
For instance, we have a xaml where we click ‘Invoices’ tab, update some values, refresh screen, after refreshing i am again using my ‘Invoices’ tab click. When my bot fails at the second click of ‘Invoices’ tab, it simply says cannot find UI element corresponding to this selector ‘<html=…’ . So i would know that ‘Invoice’ click failed, but i may not know if the first or second failed.
We need to debug through logs, to find which activity failed.
If, in case, i could set some custom exception message for activities, it reduces the debug time.
For first click: Custom message*= ‘Click invoice to update invoices’
For second click: Custom message*= ‘Click invoice to check status after update’
- similar to throw exception message
When my second click fails, i could get something like ‘Click invoice to check status after update failed’ from logs.
The example here may look simple, but for complex processes that access same elements multiple times, this would help a lot to debug quickly.