I'm trying to use CulebraTester2 to dump the Window hierarchy. I'm testing an app where the text of some TextView changes: the first time I call dumpWindowHierarchy
the obtained JSON content corresponds to the text shown, when the text changes and I try to call again dumpWindowHierarchy
, the text of the TextView remains unaltered in the JSON even if it actually has changed in the app. I've noticed instead that the bounds change.
I need to get the actual text shown by the app, is there a way?
Thanks.
UPDATE
I've tried using the mrin9 provided api and also using python vc.uiAutomatorHelper.ui_device.dump_window_hierarchy()
and the result is the same: the text is not updated.
A snippet of the JSON:
{
"id": 38,
"parent": 36,
"text": "Si pensa che porti fortuna mangiare:",
"package": "com.mypackage",
"checkable": false,
"clickable": false,
"index": 2,
"content_description": "",
"focusable": false,
"resource_id": "questionDataQuestionText",
"enabled": true,
"password": false,
"long_clickable": false,
"long_text": "android.view.View_questionDataQuestionText id=38 parent=36",
"clazz": "android.view.View",
"scrollable": false,
"selected": false,
"checked": false,
"focused": false,
"bounds": [
150,
648,
930,
1010
],
"children": []
}
I added the clock widget to the home screen as it has a changing text that we can use as an example (otherwise we both should install the same app which might not be possible).
Then, using this script I could verify the text changes.
and produces this output when run
You can probably adapt the script and test your app.