Bot behaving erratically

We have a bot accessing Sage ERP, built on the RE framework. When the bot is run, some transactions are executed successfully, some fail. The ones which fail are unpredictable. Even after running the bot with the same transaction data multiple times, there is no knowing which transactions will fail to complete.

The failure typically happens due to the wrong uielement getting selected.

The main issue is that the bot works sometimes and fails at others, with no predictability on what would happen for a given transaction.

It is not your data then which is the issue, but rather the stability of your selectors.

Create a unit test which clicks on one of the elements which have been wrongly selected as you have stated. Run this as many times as you need to confirm the issue can be replicated. Maybe refresh the target application as well in between tests to make it a realistic test.

It is possible the selectors for the elements are not static and you need to create more dynamic selectors for the workflow to work more reliably. Use the UiExplorer to understand the syntax of the selectors which are causing the issue, understand how these change when the application is refreshed, then finally design selector syntax which takes account of changing attributes within those selectors using wildcards for example.

Hi Ronan

Thanks for the help. We have done all the selector checks. The issue is that it works well in some cases and randomly fails in others. It is definitely not the data but the sheer unpredictability of when has flummoxed us.


So when it fails on a selector, what is the error message? That it cannot find the selector?

Please provide an example of this and show us the selector in your click activity and the selector as returned by the UiExplorer at the time of failing.

Hey Shabbir,

Try to adding delays and check for element exist before performing activity. Some times due to Network Latency page rendering might be held up.

Hi Ronan

It finds another selector and moves forward with that selection. Sometimes it leads to an exception thrown a few activities down the line, sometimes it does not trigger an exception but of course errors have happened in the data entry.

During debug or with UIExplorer, the validation always works. We have selectors based on wildcards and validation always selects the right field

We have put delays where possible. Element exists are also there. Our worry is that there is a more structural problem where even if we fix the problems we see, new problems may come up.

I have seen similar behavior where it works in debug mode but not when run normally. As suggested above, delays have helped for me however your issue persists.

It seems strange certainly that you have placed ‘element exists’ activities in front of your clicks, yet the bot still does not click on the correct element. The only logical explanation is that both selectors, i.e. the one you want to click and the invalid one that it does eventually click, are both valid and it simply selects which ever had loaded first.

It would be interesting to see in this case:

  1. The selector syntax of the element you are wanting to click
  2. The selector syntax of the element it does click
  3. The selector syntax that you have placed inside your click activity.
  4. The selector syntax of any ‘Element Exists’ activity you have placed beside this.

Sometimes it leads to an exception thrown a few activities down the line, sometimes it does not trigger an exception but of course errors have happened in the data entry.

We have not yet been able to fix these problems. However with liberal delay blocks (both in number and duration) we have reduced the failure rate from around 60% to closer to 15%.

The fact that the same activity sometimes works and sometimes doesn’t still confounds us.

I would still like to see the above info if possible. The issue has to be in your selectors and the structure of the target webpage, as it works some of the time. Its a question of being able to get information on both for anyone to help you fully resolve.