一.本地连接
<code class="language-python"># -*- coding: utf-8 -*-# from poco.drivers.android.uiautomation import AndroidUiautomationPoco from airtest.core.api import * class_name = "059b670d0c634127" connect_device(f"Android:///{class_name}?cap_<a href="https://www.gaodaima.com/tag/method" title="查看更多关于method的文章" target="_blank">method</a>=JAVACAP&&ori_method=ADBORI&&touch_method=ADBTOUCH") #其中cap_method=JAVACAP&&ori_method=ADBORI&&touch_method=ADBTOUCH 对应你在airtest编辑器上连接时候的勾选 dev=set_current(class_name) #多机操作时候需要加,切换到你想要操作的机子上 poco = AndroidUiautomationPoco(device=dev,use_airtest_input=True, screenshot_each_action=False) </code>
www#gaodaima.com来源gao@dai!ma.com搞$代^码网搞代码
二.远程连接
<code class="language-python">手机建立服务 adb tcpip 5555 查看手机ip adb shell ifconfig wlan0 #其中 inet addr:xxxxx就是了 进行连接 adb connect 手机ip:5555 </code>