Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uiautomator dump in Runtime.getRuntime().exec() not working

When I put this line in my test app, Runtime.getRuntime().exec("uiautomator dump"), no .xml file was dumped. I am pretty sure I checked the correct location.

I tried to debug my app by putting a break point. When it reaches the break point, I adb shell on terminal to get into the device, and then manually run uiautomator dump from terminal, then it says killed, no .xml file was produced either.

adb shell uiautomator dump only produces .xml file when I killed my app, and run this command from terminal.

Is this a sort of permission or accessibility problem?

like image 726
michellew Avatar asked Sep 16 '25 14:09

michellew


1 Answers

You can't use adb shell uiautomator dump while a test is running.

You can call UiDevice.dumpWindowHierarchy(..) from inside your test instead.

like image 176
Allen Hair Avatar answered Sep 19 '25 04:09

Allen Hair