Shortcuts for Common Cases

Try steps and "Try Next Alternative" error handling (as described in the previous section) are very flexible tools. Used in the proper way, they support many different ways to handle errors, and in this section, we will show a couple of simple and common cases. In fact, these cases are so common that they are also supported by specialized error handling options, which we will also show.

Skip Following Steps

In many cases, a robot must be able to handle optional elements on a web page. That is, if the elements are present, they must be handled (for example, data must be extracted), but if they are absent, the handling of these elements can simply be skipped. Their absence is not an error, but an expected situation. This can be expressed as follows in a robot. Step A tests if the elements are present (for example by trying to extract something), while steps B and C do further processing that depends on the success of step A:

If step A is not successful (because elements are missing on the web page), its "Try Next Alternative" () error handling will send notice to the Try step (which is unnamed in this example). This will cause the second and empty branch to be executed, after which execution of that whole branch that starts in the Try step is done. Thus steps B and C are not executed if step A is not successful.

This situation happens so often that a specific error handling option "Skip Following Steps" has been introduced as a shortcut. It makes it possible to simplify the example as follows:

The error handling for step A is configured as follows. This is the default configuration for all new steps:

Strictly speaking, you need to uncheck the "API Exception" and "Log as Error" checkboxes to get exactly the same behavior as shown above with the Try step. This is because the default values for these checkboxes are different for these two ways to do error handling.

Note that if step B had been similar to step A (that is, if step B had also had "Try Next Alternative" error handling), this same shortcut could still be used.

Ignore and Continue

Sometimes, some action (extraction, whatever) needs to be done if some condition is met, and otherwise it can simply be skipped. Subsequent steps do not depend on the result (or a proper default for the result has been set up in advance). This can be expressed as follows:

If step A is not successful, its "Try Next Alternative" () error handling will cause the second and empty branch from the (unnamed) Try step to be executed. After this, execution continues at step B with the same robot state that was input to step A. Thus step A is effectively skipped.

This can also be done without the Try step by using the error handling option "Ignore and Continue" () on step A:

One interesting possibility is to have the situation logged even though it is otherwise ignored. This can be achieved by configuring error handling on step A as follows:

The same can be done if you prefer to use the method with a Try step.