目录
通过adb获取当前activity的名称
(多个)安卓手机通过usb连接电脑(airtest调用手机上的微信)
(多个)安卓手机通过无线连接(wifi)电脑(airtest调用手机上的微信)
# 通过adb获取当前activity的名称
# windows: 用adb.exe启用
# .\adb shell dumpsys activity activities | findstr mResumedActivity
# -*- encoding=utf8 -*-
__author__ = "starkYang"
from airtest.core.android.android import *
from airtest.core.android.adb import *
from airtest.core.api import *
auto_setup(__file__)
adb = ADB()
devicesList = adb.devices()
print("本机N个设备,分别是",devicesList)
devicesNum = len(devicesList) > 1
#判断连接的安卓设备数量
# assert_equal(devicesNum,True,"设备连接数量至少为2")
for i in range(len(devicesList)):
print(i,devicesList[i][0],"ddddd")
# 链接设备
connect_device("android:///" + devicesList[i][0])
#微信app应用名称
PKG="com.tencent.mm"
#微信app活跃窗口名称
ATY='ui.LauncherUI'
# 唤醒并解锁目标设备
wake()
# 返回目标设备的主屏幕
home()
# 停止app
# stop_app(activity=PKG)
# 打开微信app
start_app(package=PKG,activity=ATY)
# -*- encoding=utf8 -*-
__author__ = "hp"
from airtest.core.android.android import *
from airtest.core.android.adb import *
from airtest.core.api import *
from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False)
auto_setup(__file__)
adb = ADB()
# 链接设备
dev = connect_device('Android:///192.168.1.105:7551?cap_method=javacap&touch_method=adb')
PKG="com.tencent.mm"
ATY='ui.LauncherUI'
# 唤醒并解锁目标设备
wake()
# 返回目标设备的主屏幕
home()
# 停止app
# stop_app(activity=PKG)
# 打开app
start_app(package=PKG,activity=ATY)