How to find an error in the macro?

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.

Where do macro errors come from?

There can be several reasons for errors in a macro:

 

  • A change in the program or page interface
  • Pop-ups on the page or in the program
  • File path error
  • Internet connection problems
  • Computer performance problems

 

We described most of these problems in the article “What can prevent a macro from working?”. Here we will focus on solutions.

How to find and fix a macro error?

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.

 

Locating an error

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.

Debugging tool

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.

  1. Here you can see what step is next in the queue for play.
  2. Stop button to stop macro playback.
  3. Play button to start playback.
  4. Next step button, which takes you only to the next step without playing the following steps.
  5. Skip next step button. This will cause the robot to skip the step shown on the left and select Skip this step on it. This means that in the next macro executions this step will be skipped permanently. This option can be unchecked in the edit window by deselecting Skip this step.
  6. The Append steps button allows recording additional steps before the step displayed in the field on the left (next step). We describe this function in detail in the article “Manual adding steps to the macro – from the panel/from the debugging tool”.
  7. The Select selector button allows you to change the selector to which the step applies. Selectors include points on the screen, cells in a table and buttons on web pages. What can this feature be useful for?

 

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?”