airtest本地連接和遠程連接


一.本地連接

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM