![airtest本地连接和远程连接[Python常见问题]](https://www.zixueka.com/wp-content/uploads/2023/10/1696830962-ab99ae75b7c4564.jpg)
一.本地连接
# -*- 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

hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 »
airtest本地连接和远程连接