Talk to our expert and start your robotic adventure
How to find an error in the macro?
A runtime error can occur not only in a newly recorded macro, but also in those we have already created that have worked correctly so far. In this article we will explain how to find and fix a macro error.
There can be several reasons for errors in a macro:
We described most of these problems in the article “What can prevent a macro from working?”. Here we will focus on solutions.
A correctly reproduced macro will stop when finished, and in the advanced view all completed steps will be highlighted in green. Those that remained grey were not executed due to a fixed condition.
If an error occurs during playback, you will be informed by the AUTOMADE robot itself. In some cases, the cause of the error will be known immediately, as we will be informed by the robot’s message. In this case, the error was due to changing the location or deleting a file from a folder.
In addition, any critical error that stops the macro playing will mark in red the step where the robot encounters the problem.
If the error is due to a problem with finding a selector, debug mode can help you. It allows to stop the macro at any time and check what is causing the failure and then fix the error.
To start debug mode, select from the list of steps the faulty one we want to investigate. Then select the “Pause step” option in the panel on the right and run the macro. The robot will stop before the selected step and enter debug mode.
If the macro is long and you do not want the whole thing to play, you can use the “Skip this step” option for earlier steps. Simply select the steps you wish to skip and press CTRL+D. However, care must be taken not to skip any key step which may prevent the macro from working correctly.
During playback, skipped steps remain marked in grey.
Once you have set the “Pause step” option, you play the macro and wait for it to stop at the selected step. When this happens, the tool will enter debugging mode, which allows you to go through the entire macro step by step to find the fault and eliminate it.
On the main panel you will see the “Next step” button
The next step is to open the debugging tool. You can use it in the basic view or list view.
The debugging tool will appear on the top of the screen. Below we describe its functions.
Example:
The macro we have been using so far has suddenly stopped working. It turns out that the design of the website used by the macro has been changed. The button that the robot clicked on has changed location and colour, and most importantly XPath, the location in the page code. Using the debugging tool, you can go to the step where the macro encounters an error. On the stopped step you will see the updated web page. All you need to do is to use the debug mode pin tool and use it to point to the new button on the page.
Importantly, in debug mode, all elements on which an action can be performed on a page are marked in yellow. So you know exactly where the robot clicks and we can easily determine the new point.
You can read more about selectors in the article “What are selectors in the AUTOMADE tool and how do they work?”