Use uiautomatorviewer error Error obtaining UI hierarchy

https://blog.csdn.net/qq_40356449/article/details/103302820#commentsedit

 

https://blog.csdn.net/dengachao/article/details/100535536

Transfer from above

 

After carrying uiautomator android8 sdk opened directly, not taken machine interface information.

The following methods can be recommended to manually taken

 

 

For the first time, learning Appium frame, when using the Android app controls uiautomatorviewer be positioned, occasionally see such an exception below, are generally Baidu, the majority did not find the answer, ever give up the use of this tool, select another tool or directly to give up Appium automation. 

 

Some chiefs will say, let go and change in the development of internal development kit (change the code), the research framework for the novice, this method, the cost is too high, in fact, in most cases is not compatible with the phone, another phone just fine , but sometimes I use the phone, and suddenly not be used. Here, there is a universal usage, reduce costs novice learning

A: first made tools

Methods as below:

Direct knock in cmd command line

adb shell uiautomator dump /sdcard/app.uix

ADB pull /sdcard/app.uix E /app.uix

# App.uix file saved to disk in E, E drive to create a new folder into app.uix (suffix have to be changed)

adb shell screencap -p /sdcard/app.png

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

# E drive to create a new folder into app.png

Because each had to write four lines of code, too much trouble, so write a batch file.

It can be run directly on the desktop

 

II: the use of tools

1: First phone connected to the adb, open the phone you want to locate the page, double-click the written instrument, after the mobile phone interface map was intercepted success

2: Open uiautomatorviewer.bat, follows FIG.

 

 

 

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

 

Of course, some people still feel this kind of trouble, of course, there are other tools also can get the page elements.
----------------
Disclaimer: This article is CSDN blogger original article "Earth _ _ clay soil", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/qq_40356449/article/details/103302820

Guess you like

Origin www.cnblogs.com/wuduoduo41/p/12359836.html