Skip to content

UiObject2 referring to wrong element #113

Open
@sravanmedarapu

Description

@sravanmedarapu

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.

uiobject2 issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions