Tag Archives: Appium framework

[Solved] uiautomateviewer Tool Error: Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException

Error Message:

Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist! Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

 

 

Solution: Turn on developer permissions on the phone, turn the USB debugging button back on, and then restart the emulator

Reference link: https://www.cnblogs.com/uniquefu/p/11496211.html

Error reporting UI hierarchy using uiautomatorviewer

For learning appium framework for the first time, when using uiautomatorviewer to locate Android App controls, you will occasionally see the following exception, which is usually Baidu. Most of them did not find the answer, so they gave up using this tool, chose other tools or gave up appium automation directly.  

Some bigwigs will say that it’s too expensive for the novice research framework to let the developer change the internal (code) of the development package. In fact, in most cases, the mobile phone is not compatible. It’s better to change the mobile phone, but sometimes the mobile phone that can be used suddenly can’t be used. Here, there is a universal use to reduce the cost of novice learning

1: Build tools first

The method is as follows

Click directly on the CMD command line

 

adb shell uiautomator dump /sdcard/ app.uix

adb pull /sdcard/ app.uix E:/ app.uix

#Storage to disk e app.uix Folder, create one in disk E in advance app.uix Formatted folder

adb shell screencap -p /sdcard/ app.png

adb pull /sdcard/ app.png E:/ app.png

#Storage to disk e app.png Folder, create one in disk E in advance app.png Formatted folder

 

Because every time you have to write four lines of code, it’s troublesome, so you write a batch file.

Put it on the desktop and run it directly: (if you don’t know how to do bat, go to Baidu by yourself)

 

2: Using tools

1: First, connect the mobile phone to the ADB, open the page to be located, double-click the written tool, and then the mobile phone interface map will be intercepted successfully

2: Open uiautomatorviewer.bat The operation is shown in the figure below

At this point, open the picture, you can locate the various elements of the page

Of course, some people still think that this kind of trouble, of course, there are other tools can also get page elements.