一.本地连接

# -*- 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

内容来源于网络如有侵权请私信删除

文章来源: 博客园

原文链接: https://www.cnblogs.com/pythonywy/p/13753353.html

你还没有登录,请先登录注册
  • 还没有人评论,欢迎说说您的想法!