diff --git a/src/Testura.Android/Device/Ui/Objects/BaseUiObject.cs b/src/Testura.Android/Device/Ui/Objects/BaseUiObject.cs
index b4a0fd8..92122df 100644
--- a/src/Testura.Android/Device/Ui/Objects/BaseUiObject.cs
+++ b/src/Testura.Android/Device/Ui/Objects/BaseUiObject.cs
@@ -60,6 +60,15 @@ public bool IsVisible(int timeout = 10)
}
}
+ ///
+ /// Check if node(s) is visible in cache.
+ ///
+ /// True if visible in cache, otherwise false.
+ public bool IsVisibleInCache()
+ {
+ return IsVisible(-1);
+ }
+
///
/// Wait for the node(s) to be hidden.
///
@@ -85,6 +94,23 @@ public bool IsHidden(int timeout = 10)
}
}
+ ///
+ /// Check if node(s) is hidden in cache.
+ ///
+ /// True if hidden, otherwise false.
+ public bool IsHiddenInCache()
+ {
+ try
+ {
+ TryFindNode(-1);
+ return false;
+ }
+ catch (UiNodeNotFoundException)
+ {
+ return true;
+ }
+ }
+
///
/// Find node(s) on the screen.
///
diff --git a/src/Testura.Android/Device/Ui/Objects/UiObject.cs b/src/Testura.Android/Device/Ui/Objects/UiObject.cs
index 0247256..f3f580a 100644
--- a/src/Testura.Android/Device/Ui/Objects/UiObject.cs
+++ b/src/Testura.Android/Device/Ui/Objects/UiObject.cs
@@ -94,6 +94,11 @@ public bool WaitForValue(Func expectedValues, int timeout = 20)
/// All found node(s)
protected override IList TryFindNode(int timeout)
{
+ if (timeout == -1)
+ {
+ return new List { Device.Ui.FindNodeFromCache(Withs) };
+ }
+
return new List { Device.Ui.FindNode(timeout, Withs) };
}
}
diff --git a/src/Testura.Android/Device/Ui/Objects/UiObjects.cs b/src/Testura.Android/Device/Ui/Objects/UiObjects.cs
index aa7bc49..f9f67fa 100644
--- a/src/Testura.Android/Device/Ui/Objects/UiObjects.cs
+++ b/src/Testura.Android/Device/Ui/Objects/UiObjects.cs
@@ -37,6 +37,11 @@ public IList ValuesFromCache()
protected override IList TryFindNode(int timeout)
{
+ if (timeout == -1)
+ {
+ return Device.Ui.FindNodesFromCache(Withs);
+ }
+
return Device.Ui.FindNodes(timeout, Withs);
}
}