From 60efa571804fc874908322c52d5b7876af4c0b30 Mon Sep 17 00:00:00 2001 From: RaiMan Date: Wed, 29 Mar 2017 10:38:16 +0200 Subject: [PATCH] fixed: findAll() should throw FindFailed according docs and support FindFailed Response handling. --- API/src/main/java/org/sikuli/script/Region.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/API/src/main/java/org/sikuli/script/Region.java b/API/src/main/java/org/sikuli/script/Region.java index ae54073c2..cb8eea5e8 100644 --- a/API/src/main/java/org/sikuli/script/Region.java +++ b/API/src/main/java/org/sikuli/script/Region.java @@ -2455,7 +2455,7 @@ public Iterator findAll(PSI target) throws FindFailed { runTime.abortScripting("FindAll: Abort:", "ImageMissing: " + target.toString()); } } - if (null != response && response) { + while (null != response && response) { log(lvl, "findAll: waiting %.1f secs for (multiple) %s to appear in %s", autoWaitTimeout, targetStr, this.toStringShort()); if (autoWaitTimeout > 0) { @@ -2466,10 +2466,15 @@ public Iterator findAll(PSI target) throws FindFailed { } if (lastMatches != null) { log(lvl, "findAll: %s has appeared", targetStr); + break; } else { log(lvl, "findAll: %s did not appear", targetStr); + response = handleFindFailed(target, img, false); } } + if (null == response) { + throw new FindFailed(FindFailed.createdefault(this, img)); + } return lastMatches; }