Next-Gen App & Browser
Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles
The UiAutomator Viewer dumps the active window's view hierarchy, and the screenshot is taken from the default display. If you want to use UiAutomator Viewer to examine a screenshot of your app, you can create both files programmatically and provide them to UiAutomator Viewer:
adb shell am start com.google.android.calendar --display 0
adb shell screencap -d 0 -p /sdcard/screencapture0.png
adb pull /sdcard/screencapture0.png .
adb shell uiautomator dump
adb pull /sdcard/window_dump.xml
mv window_dump.xml window_dump0.uix
By selecting "Open" in the UiAutomator Viewer and selecting screencapture0.png and window_dump0.uix, you can open an app on the secondary display.
By opening an app on the secondary display, the focus moves to the other display, and you can reinvoke the same commands to get the two files:
adb shell am start com.google.android.calendar --display 1
adb shell screencap -d 1 -p /sdcard/screencapture1.png
adb pull /sdcard/screencapture1.png .
adb shell uiautomator dump
adb pull /sdcard/window_dump.xml
mv window_dump.xml window_dump1.uix
KaneAI - Testing Assistant
World’s first AI-Native E2E testing agent.