From 666a5a8f397ba5ae832d8a7b9edde8c41422c6fe Mon Sep 17 00:00:00 2001 From: moizjv Date: Tue, 21 Apr 2015 00:04:31 -0700 Subject: [PATCH] Ignoring UiObjectNotFoundException when parsing UiScrollable parser --- .../appium/android/bootstrap/utils/UiScrollableParser.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/devices/android/bootstrap/src/io/appium/android/bootstrap/utils/UiScrollableParser.java b/lib/devices/android/bootstrap/src/io/appium/android/bootstrap/utils/UiScrollableParser.java index 9065921b..bee3fbf8 100644 --- a/lib/devices/android/bootstrap/src/io/appium/android/bootstrap/utils/UiScrollableParser.java +++ b/lib/devices/android/bootstrap/src/io/appium/android/bootstrap/utils/UiScrollableParser.java @@ -1,6 +1,7 @@ package io.appium.android.bootstrap.utils; import com.android.uiautomator.core.UiObject; +import com.android.uiautomator.core.UiObjectNotFoundException; import com.android.uiautomator.core.UiScrollable; import com.android.uiautomator.core.UiSelector; import io.appium.android.bootstrap.Logger; @@ -244,6 +245,11 @@ public class UiScrollableParser { e.printStackTrace(); throw new UiSelectorSyntaxException("problem using reflection to call this method"); } catch (InvocationTargetException e) { + // Ignoring UiObjectNotFoundException as this handled during actual find. + if (e.getCause() instanceof UiObjectNotFoundException) { + Logger.debug("Ignoring UiObjectNotFoundException when using reflection to invoke method."); + return; + } Logger.error(e.getCause().toString()); // we're only interested in the cause. InvocationTarget wraps the underlying problem. throw new UiSelectorSyntaxException("problem using reflection to call this method"); }