diff --git a/src/main/java/org/cloud/sonic/driver/android/service/impl/UiaClientImpl.java b/src/main/java/org/cloud/sonic/driver/android/service/impl/UiaClientImpl.java index 7c6b43a..41d24e8 100644 --- a/src/main/java/org/cloud/sonic/driver/android/service/impl/UiaClientImpl.java +++ b/src/main/java/org/cloud/sonic/driver/android/service/impl/UiaClientImpl.java @@ -303,10 +303,11 @@ public List findElementList(String selector, String value, Integ androidElementList.add(new AndroidElementImpl(id, this)); } else { logger.error("parse element id %s failed.", ele); - continue; } } - break; + if (androidElementList.size() > 0) { + break; + } } else { logger.error("elements not found. retried %d times, retry in %d ms.", wait, intervalInit); errMsg = b.getErr().getMessage(); diff --git a/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java b/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java index e07a74b..aeb47b0 100644 --- a/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java +++ b/src/main/java/org/cloud/sonic/driver/ios/service/impl/WdaClientImpl.java @@ -452,10 +452,11 @@ public List findElementList(String selector, String value, Integer r iosElementList.add(new IOSElementImpl(id, this)); } else { logger.error("parse element id %s failed.", ele); - continue; } } - break; + if (iosElementList.size() > 0) { + break; + } } else { logger.error("elements not found. retried %d times, retry in %d ms.", wait, intervalInit); errMsg = b.getErr().getMessage();