uiautomator2 wifi连接手机

mac2022-06-30  22

【实施方法】 手机和电脑同时连接到同一个wifi上 1、开启远程adb #开启远端adb,这一步需要手机通过USB连接到电脑 adb tcpip 5555 #结果如下:restarting in TCP mode port: 5555 #然后断开USB adb connect 192.168.3.2:5555 #其中192.168.3.2是手机的局域网IP地址 adb devices #确认可以看到设备信息 2、通过adb命令启动uiautomator2的agent db shell /data/local/tmp/atx-agent -d 3、通过uiautomator2脚本连接手机执行用例 import uiautomator2 as u2 d = u2.connect_wifi('192.168.3.2') print(d.info) 发现可以成功执行 PS:因为有些操作系统上uiautomator2的agent无法自动拉起,所以需要手动通过adb命令拉起

转载于:https://www.cnblogs.com/c-x-a/p/11176066.html

最新回复(0)