一.本地連接
# -*- 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_method=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)
二.遠程連接
手機建立服務
adb tcpip 5555
查看手機ip
adb shell ifconfig wlan0 #其中 inet addr:xxxxx就是了
進行連接
adb connect 手機ip:5555
