您可以简单地使用 AndroidViewClient 的转储:
$ dump --help
usage: dump [OPTION]... [serialno]
Options:
-H, --help prints this help
-V, --verbose verbose comments
-v, --version
-I, --ignore-secure-device ignore secure device
-E, --ignore-version-check ignores ADB version check
-F, --force-view-server-use force view server use (even if UiAutomator present)
-S, --do-not-start-view-server don't start ViewServer
-k, --do-not-ignore-uiautomator-killed don't ignore UiAutomator killed
-w, --window=WINDOW dump WINDOW content (default: -1, all windows)
-i, --uniqueId dump View unique IDs
-x, --position dump View positions
-d, --content-description dump View content descriptions
-c, --center dump View centers
-f, --save-screenshot=FILE save screenshot to file
-W, --save-view-screenshots=DIR save View screenshots to files in directory
-D, --do-not-dump-views don't dump views, only useful if you specified -f or -W
在你的情况下,可能
$ dump -d
够了。
编辑
如果您想要的不仅仅是保存屏幕的逻辑内容更复杂,您可以使用culebra(AndroidViewClient 中的另一个工具),它允许您使用 GUI 生成自动化测试:
$ culebra -UG -o mytest.py
您可以与 culebra 主窗口中设备屏幕的镜像表示进行交互以生成测试。保存。在任何设备上运行它,甚至是完全不同的设备。