开源云真机平台-Sonic平台-python自定义脚本(持续更新中)
1、获取设备序列号
udId = sys.argv[1:][1]
如:
# -*- coding: utf-8 -*-
import os,sys,json
udId = sys.argv[1:][1]
2、获取全局参数
text1 = sys.argv[1:][2]
如:
# -*- coding: utf-8 -*-
import os,sys,json
text1 = sys.argv[1:][2]
3、自动开启WIFI
# -*- coding: utf-8 -*-
import os,sys,json
udId = sys.argv[1:][1]
text1 = sys.argv[1:][2]
def run_command(command):
# command = f"""adb -s {udId} shell settings put system screen_brightness 0"""
print(f"command={command}")
os.system(command)
def run_test(udId):
run_command(f"""adb -s {udId} shell svc wifi enable""")
print(f"udId={udId},text={text1},type={type(text1)}")
print("="*30)
run_test(udId)
4、adb模拟滑动
import os,sys,json,time
udId = sys.argv[1:][1]
text1 = sys.argv[1:][2]
command=f"""adb -s {udId} shell input swipe 165 700 165 100"""
print(f"command={command}")
os.system(command)
time.sleep(1)