Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

d.dump() missing views then stuck in bad state #156

Closed
kevin-brotcke opened this issue Apr 1, 2016 · 6 comments
Closed

d.dump() missing views then stuck in bad state #156

kevin-brotcke opened this issue Apr 1, 2016 · 6 comments

Comments

@kevin-brotcke
Copy link

I keep hitting a bug where resource IDs suddenly disappear, even though the device state hasn't changed and can verify in uiautomatorviewer. I'm able to reproduce the bug in as few lines as:

# At home screen of device tested
>>> from uiautomator import device as d
>>> d.server.stop()  # Make sure we are in a good state
>>> d(resourceId='android:id/navigationBarBackground).exists
True
>>> d.dump()  # Does not show the full view hierarchy, navigationBarBackground missing
>>> d(resourceId='android:id/navigationBarBackground').exists
False

At this point it will continue to return False until I restart the uiautomator server or kill the adb service.

To find a specific example, take a uiautomator dump with uiautomatorviewer first, then take one using the Python wrapper. Nodes that appear near the bottom of uiautomatorviewer do not always show up in d.dump().

Environment info

uiautomator: 0.2.6
device: Amazon Fire HD 6
OS: Ubuntu 14.04 LTS

@kevin-brotcke
Copy link
Author

Note this isn't reproducible by using d.dump(compressed=False). I think what's happening is that AutomatorServiceImpl.dumpWindowHierarchy is setting device.setCompressedLayoutHeirarchy(compressed), but never changes it back to uncompressed. Once d.dump(compressed=True) is called, all calls after reuse device and return a compressed view hierarchy resulting in missing resource IDs.

kevin-brotcke pushed a commit to kevin-brotcke/android-uiautomator-server that referenced this issue Apr 1, 2016
If the d.dump(compressed=True) is called all subsequent calls will
only show a compressed view. Force the compressed layout heirarchy
state back to the default of false to make subsequent calls work
correctly.

xiaocong/uiautomator#156
@hongbinbao
Copy link
Collaborator

hongbinbao commented May 24, 2016

hi,
have a try follow your description. Once the compressed mode was set. The nodes which was regarded as "FLAG_INCLUDE_NOT_IMPORTANT_VIEWS" will be removed by accessibility framework.
Anyway. the status of Layout Heirarchy should back to the default value.

@kevin-brotcke
Copy link
Author

Fix merged.

@greenheart0707
Copy link

The info is null when I use d.dump() to dump device's info, while it was normal if I dump device's info in serial(By launch the command "uiautomator dump xx.xml"), what's more, device's UI info can also be obtained by adb shell(Enther into adb shell, and launch the command of "uiautomator dump xx.xml"), I don't know why.

xml_file.zip

@shfscut
Copy link

shfscut commented Sep 22, 2017

@greenheart0707
hi i have encountered the same question, have you solved this problem??

@siva-kranthi
Copy link

I am also facing same issue :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants