Open
Description
Referring to previously created UiObject2
object which is not exist in the screen (in the same activity) pointing to a random element instead of throwing StaleObjectException
.
Example code snippet:
UiObject2 elementInScrollView = mDevice.findObject(By.desc("Auto Complete"));
elementInScrollView.getText();
//returns "Auto Complete"
//scroll down to make sure that "Auto Complete" not present in the screen
mDevice.swipe(100, 400, 100, 50, 100);
elementInScrollView.getText();
//returns some random element text in the screen ex: List
mDevice.pressBack();
elementInScrollView.getText();
//throws `StaleObjectException`
Device API Level: 23
AUT: API Demos(Inbuilt app)
I suspect something wrong to AccessibilityNodeInfo
here when getAccessibilityNodeInfo
called from UiObject2
PFA screenshot for the functional understanding.