1、Appium元素定位工具(UIAutomatorView/Appium Desktop Inspector/weditor)python
1.UIAutomatorViewandroid
android SDK自帶的定位工具,位置:D:\Program Files\android-sdk\tools\uiautomatorview.bat瀏覽器
不須要啓動appium serverapp
元素屬性:框架
class:工具
package:ui
2.Appium Desktop Inspectorserver
appium server中帶的工具blog
啓動慢ip
3.Weditor
Uiautomator2 python第三方庫,appUI自動化框架
安裝:
命令1:pip install Uiautomator2
解決安裝失敗的方案:
直接運行pip install uiautomator2時,安裝不了,沒法訪問,提示:因爲目標計算機積極拒絕,沒法鏈接。(被牆了)。
因此使用國內鏡像源安裝:pip install -i https://pypi.doubanio.com/simple uiautomator2,提示:Couldn’t find index page for ‘pbr’ (maybe misspelled?)。
提示缺乏pbr模塊,因此先安裝pbr模塊,再安裝uiautomator2(另外pbr模塊在線安裝也是沒法訪問,只能離線安裝)。
一、下載pbr模塊:pbr下載:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pbr
二、下載好pbr-5.4.4-py2.py3-none-any.whl後,使用pip install xxx/xxx/pbr-5.4.4-py2.py3-none-any.whl(該文件路徑)進行安裝。
三、pbr安裝成功後,再執行pip install -i https://pypi.doubanio.com/simple uiautomator2,安裝uiautomator2,便可正常安裝。
命令2:python -m uiautomator2 init 推送一個包到模擬器。
命令3: pip install weditor
命令4:啓動weditor : python -m weditor
瀏覽器會啓動一個窗口。裏面能夠實時對模擬器進行定位
總結:通常就用weditor或則appium的inspector就能夠了。