Selenium IDE: Ignore these errors and go to next s

2019-07-29 23:03发布

问题:

When I run the macro sometimes I get

  * [error]

    time out when looking for element 'css=button.btn.btn-primary.col-xs-8.m-0-left.m-md-top.m-0-bottom'

  * [info]

    Test case failed (Runtime 8.86s)

==== Is there a way to ignore these errors and go to next step?

Like: if (notFound) go to next step

PS: I am using the Kantu Selenium IDE.

回答1:

Two solutions:

1. Use FlowControl

The old Firefox IDE and the Kantu Selenium IDE both support flowcontrol. Kantu has an internal variable that contains the status (error/no error) of the last command. So the solution is:

CLICK....
IF | ${!LastCommandOK |
..do something
ENDIF

2. Easier: Use !ErrorIgnore to ignore errors

This solution works only with Kantu. Here, setting

store | true | !ErrorIgnore

tells kantu to ignore errors and continue with the next command.