I have a multiple display scenario, which I want to test with Appium in the end. However, right now I am struggeling already with UiAutomatorViewer.
This is my scenario:
- I have setted up Android Emulator with a secondary display: The left screen has Chrome launched, the right side YouTube (just some abitrary apps).
- When I launch uiautomatorviewer (or appium using uiautomator2), it just retrieves me the content of the "main" display and I can just access the elements on this screen. Appium is showing me the same content.
I don't know, how I can access the secondary display as well. In a perfect approach, I would basically be able to identify all apps on all displays. Is this somehow possible?
In addition, I need to test multiple apps. Because of that single app approaches like Espresso don't work for me.


According to the source code, UI automator viewer dumps the view hierarchy of the active window and the screenshot is the one from the default display.
If you want to use ui automator viewer and analyze the right screenshot (and the corresponding UI hierarchy), a possible workaround might be to create both files programmatically and provide them to ui automator viewer:
now you can select "Open" on ui automator viewer and select
screencapture0.pngandwindow_dump0.uix.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 2 files:
and this time the files to provide to ui automator viewer are
screencapture1.pngandwindow_dump1.uix.Not sure if the same approach can be leveraged also to execute the tests against a specific screen.