赞
踩
1、数据线连接电脑,打开usb开发调试,点击连接,同意安装一些授权
查看你的设备有哪些App,并打开对应App
from airtest.core.android.android import Android
devs = device()
print(devs.list_app(third_only=True))
启动app
start_app(package,activity=None)
2、简单代码
from poco.drivers.android.uiautomation import AndroidUiautomationPoco poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False) # from airtest.core.android.android import Android # devs = device() # print(devs.list_app(third_only=True)) # start_app("com.tencent.mm") # sleep(2) # swipe((300,500),(300,1510)) # sleep(2) # poco("com.tencent.mm:id/bp").offspring("com.tencent.mm:id/d6_").child("android.widget.RelativeLayout").offspring("com.tencent.mm:id/qc").offspring("com.tencent.mm:id/k").child("android.widget.LinearLayout")[1].offspring("com.tencent.mm:id/qw").child("android.widget.RelativeLayout")[0].offspring("com.tencent.mm:id/zq").click() # wait(Template(r"tpl1567474678112.png", record_pos=(-0.01, 0.806), resolution=(1080, 1920))) # poco(text="大家都在搜“高性价比手机”").click() # hild("android.view.View").child("android.view.View").click() # poco("android.widget.LinearLayout").offspring("com.tencent.mm:id/dbq").child("android.widget.FrameLayout").child("android.widget.FrameLayout").child("android.widget.FrameLayout")[1].child("android.widget.RelativeLayout").child("android.widget.FrameLayout").child("android.widget.FrameLayout").child("android.widget.FrameLayout")[1].offspring("android.view.ViewGroup").child("android.widget.FrameLayout").offspring("android.webkit.WebView")[1].child("android.view.View")[1].child("android.view.View")[0].child("android.view.View")[0].child("android.widget.Image").click() list=[ '卸妆', '精华', '乳液面霜', '眼部护理', '唇部护理', '美容仪器', '防晒', '护肤工具'] try: for m in range(len(list)): # touch(Template(r"tpl1567476895524.png", record_pos=(0.419, -0.654), resolution=(1080, 1920))) sleep(2) touch(Template(r"tpl1567480444832.png", rgb=True, record_pos=(-0.031, -0.659), resolution=(900, 1600))) text("%s"%(list[m])) # poco("android.widget.LinearLayout").offspring("com.tencent.mm:id/dbq").child("android.widget.FrameLayout").child("android.widget.FrameLayout").child("android.widget.FrameLayout")[1].child("android.widget.RelativeLayout").child("android.widget.FrameLayout").child("android.widget.FrameLayout").child("android.widget.FrameLayout")[1].offspring("android.view.ViewGroup").child("android.widget.FrameLayout").offspring("android.webkit.WebView")[1].child("android.view.View")[1].child("android.view.View")[1].click() touch(Template(r"tpl1567476787525.png", record_pos=(0.416, -0.659), resolution=(1080, 1920))) sleep(6) for i in range(55): swipe((300,1500),(300,10)) sleep(2) except: pass
3、安装apk(参考 https://www.cnblogs.com/starkYang/p/10547278.html)
在这里插入代码# -*- encoding=utf8 -*- __author__ = "lonng" from airtest.core.api import * from airtest.core.android.android import * from airtest.core.android.adb import * INSTALL_PATH = r"C:\Users\lonng\Desktop\苹果电脑\JustTrustMe.apk" auto_setup(__file__) adb = ADB() devicesList = adb.devices() print(devicesList) connect_device("android:///") android = Android() android.install_app(INSTALL_PATH,True)片
4,安装xposed软件(各个版本兼容问题)
或者直接更新到v89,安卓5.1安装成功
https://forum.xda-developers.com/showthread.php?t=3034811
需要在这个连接下载对应版本手机的xposed软件
SDK21 is Android 5.0 (Lollipop), SDK22 is Android 5.1 (also Lollipop) and SDK23 is Android 6.0 (Marshmallow).
For Nougat, SDK24 is Android 7.0 and SDK25 is Android 7.1.
For Oreo, SDK26 is Android 8.0 and SDK27 is Android 8.1.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。