【问题标题】:How to continue from FindFailed exception in sikuli, instead of re executing the entire script如何从 sikuli 中的 FindFailed 异常继续,而不是重新执行整个脚本
【发布时间】:2019-11-13 15:18:43
【问题描述】:
我是一名游戏测试员,必须多次点击特定的“旋转”按钮图像。
在使用 sikuli 识别旋转按钮图像的过程中,我在线程“main”FindFailed 中遇到异常。我基本上使用 Eclipse 作为 IDE 和 Selenium WebDriver 和 Java。
我想从之前失败的地方继续测试,而不是重新运行整个脚本,你能否指导我使用代码来运行我之前出错的地方的脚本?
【问题讨论】:
标签:
java
automation
sikuli
【解决方案1】:
只需在您的流程中添加一些异常处理逻辑。例如:
int retries = 3;
for (int i = 0; i < retries; i++) {
try {
//do whatever you need that can throw an exception
break; //will break the loop once the above operation succeeded
} catch (FindFailed e) {
Thread.sleep(1000); //wait for one sec (if needed)
}