Two ways of positioning elements
1. Uiaotomator (installed SDK)
2. Use Weditor (downloaded weditor)
Use Uiaotomator
Found on the computer \ android-sdk \ tools \ uiautomatorviewer.bat files in the directory, double-click to open
Phone screen capture
PC and android first need to connect via USB, adb devices command to view the device information
Then in the UI Automator View, click on the second icon in the upper left corner of the phone screen capture (capture only the current page phone stays; if the switch need to re-click to refresh the page)
Positioning elements
Click on the left side of the element, view the properties information element in the lower right corner, the upper right corner to view the layout information
The main attributes:
index、text(name)、resource-id(id)、class、package、content-desc(name)
It can also be used to locate xpath
======================================================================================
======================================================================================
Use Weditor
Android SDK built-in tools uiautomatorviewer.bat, when the running uiautomator2, uiautomatorviewer.bat not up and running, the conflict between them is too severe.
It is recommended to use Weditor
installation method
(Prerequisite: You must have python environment on a computer)
Command line to run: pip install --pre weditor
uiautomator2 end of the phone installation
python -m uiautomator2 init
Instructions
Enter the command python -m weditor, automatically opens in a browser
Connected devices
https://www.jianshu.com/p/209d46ce0904