日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

UIAutomator2

發布時間:2025/3/15 编程问答 17 豆豆
生活随笔 收集整理的這篇文章主要介紹了 UIAutomator2 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

下載免安裝python3.8

https://www.python.org/ftp/python/3.8.0/python-3.8.0-amd64.exe

不要使用3.9暫時不兼容pillow等插件

?

3.8免安裝版

要單獨安裝progress?1.5?py2.py3?none?any.whl插件

?

更新pip

python -m pip install --upgrade pip

?

安裝UIAutomator2

pip3 install --pre -U uiautomator2

?

?

初始化UIAutomator2

python -m uiautomator2 init

?安裝后模擬器能看到一個ATX app (win環境沒有)

C:\Users\Administrator>python -m uiautomator2 init [I 200411 21:07:04 init:154] uiautomator2 version: 2.7.1 [I 200411 21:07:04 init:347] Install minicap, minitouch [D 200411 21:07:04 init:58] Use cached assets: C:\Users\Administrator\.uiautomator2\cache\minitouch-7b41fbda87\minitouch [D 200411 21:07:04 init:231] Push to /data/local/tmp/minitouch:0755 [I 200411 21:07:04 init:350] abi:x86 seems to be android emulator, skip install minicap [D 200411 21:07:04 init:249] apk-debug package-info: {'version_name': '2.3.1', 'version_code': '2003001', 'flags': ['DEBUGGABLE', 'HAS_CODE', 'ALLOW_CLEAR_USER_DATA', 'ALLOW_BACKUP'], 'first_install_time': datetime.datetime(2020, 4, 11, 14, 35, 41), 'last_update_time': datetime.datetime(2020, 4, 11, 14, 35, 41), 'signature': '37f827cf'} [D 200411 21:07:04 init:250] apk-debug-test package-info: {'version_name': '', 'version_code': '', 'flags': ['DEBUGGABLE', 'HAS_CODE', 'ALLOW_CLEAR_USER_DATA', 'ALLOW_BACKUP'], 'first_install_time': datetime.datetime(2020, 4, 11, 14, 35, 43), 'last_update_time': datetime.datetime(2020, 4, 11, 14, 35, 43), 'signature': '3d2d4b48'} [I 200411 21:07:04 init:365] Already installed com.github.uiautomator apks [D 200411 21:07:04 init:285] Real version: [0, 9, 4], Expect version: [0, 9, 4] [D 200411 21:07:04 init:161] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d') [I 200411 21:07:04 init:372] Check atx-agent version [D 200411 21:07:04 init:382] Forward: local:tcp:59674 -> remote:tcp:7912 [D 200411 21:07:04 init:385] atx-agent version 0.9.4 Successfully init AdbDevice(serial=emulator-5554)

?

adb connect 192.168.2.12

編寫python腳本 iffyhello.py

import uiautomator2 as ua device = ua.connect("192.168.2.12:5555") print(device) device.app_start('com.android.settings', '.Settings') device(text="WLAN").click()

運行腳本

python iffyhello.py

?

元素定位插件

pip install weditor -i https://pypi.tuna.tsinghua.edu.cn/simple/

運行 元素定位插件 python -m weditor?

?

總結

以上是生活随笔為你收集整理的UIAutomator2的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。