首页 > 解决方案 > 机器人框架:如果任何关键字在循环内失败,则继续 FOR 循环

问题描述

在机器人框架中,即使循环内的任何关键字失败,我也想继续循环。例如,我有如下所示的代码:

FOR    ${member}    IN    @{all data members}
      Keyword 1   ${member}
      Keyword 2   ${member}
      ..............
      Keyword n   ${member}
END

如果任何关键字(例如关键字 2)失败,FOR 循环执行应该继续。

标签: seleniumselenium-webdriverautomated-testsrobotframeworkui-automation

解决方案


您可以Run Keyword And Continue On Failure在每个关键字之前使用关键字,也可以使用关键字Run Keyword And Return Status并手动处理错误。


推荐阅读