自动化篇 | 聊聊 Python 自动化脚本打包成 APK
package_name = 'com.ss.android.ugc.aweme'
activity_name = 'com.ss.android.ugc.aweme.splash.SplashActivity'
# 部分手机需要开启模拟点击
start_app(package_name,activity=activity_name)
device_attrs = device()
print(device_attrs.uuid)
# 获取设备的高度和宽度
width, height = device_attrs.get_current_resolution()
print(width)
print(height)
# 开始刷抖音
while True:
# 滑动一次
swipe( (width * 0.5, height*3/ 4),(width * 0.5, height / 4),duration=1)
sleep(2)
# 开启自动化任务
adb shell am instrument -w com.netease.open.airbase/android.support.test.runner.AndroidJUnitRunner
width = 1080
height = 2160
swipe( (width * 0.5, height*1/ 4),(width * 0.5, height*3 / 4),duration=0.5)
赞 (0)