Advertisement

调用adb命令以提取设备UI层次结构的信息

阅读量:

安卓系统的版本需高于4.0,并且需要启用View Server功能(不过这一操作并非所有设备都必需,部分手机即便未开启也可通过Hierarchy Viewer查看应用程序的用户界面布局)。若无法正常显示相关内容,则需执行相应的开启指令:

复制代码
    adb shell service call window 1 i32 4939

接下来可通过运行以下指令来确认View Server是否已启用:

复制代码
    adb shell service call window 3

当返回结果呈现为:Result: Parcel(00000000 00000001 '........') 时,表明View Server当前处于激活状态;若返回内容为:Result: Parcel(00000000 00000000 '........'),则意味着View Server已被停用。
如需对View Server进行关闭操作,可执行以下指令:

复制代码
    adb shell service call window 2 i32 4939

当成功利用uiautomator工具识别出应用程序的界面组件时,意味着可以执行以下相关指令:

复制代码
    adb shell uiautomator dump --compressed  /dat

全部评论 (0)

还没有任何评论哟~