一、安裝
Git地址:https://github.com/alibaba/taobao-iphone-device
安裝:pip install -U tidevice
二纲缓、使用-命令行
1痘拆、獲取設(shè)備信息
tidevice list --json
BD0E82B1-F792-4CA3-99F0-B5ED06916032.png
2仰禽、獲取已安裝應(yīng)用列表
tidevice applist
E9B55D3A-4AD0-4415-A07E-3BDCE770321B.png
3、啟動/停止應(yīng)用
啟動應(yīng)用
tidevice launch com.example.demo
停止應(yīng)用
tidevice kill com.example.demo
4纺蛆、獲取手機(jī)崩潰文件
tidevice crashreport --list
291D564C-92DD-48BF-9CED-2EBEC0220555.png
5吐葵、獲取應(yīng)用性能數(shù)據(jù)
4DA226C7-8AD4-407B-A2B6-5B38B34BB3E7.png
三、使用
# -*- coding:utf-8 -*-
import time
import tidevice
from tidevice._perf import DataType
run_device = tidevice.Device()
perf = tidevice.Performance(run_device, [DataType.CPU, DataType.MEMORY, DataType.NETWORK, DataType.FPS, DataType.PAGE, DataType.SCREENSHOT, DataType.GPU])
def callback(_type: tidevice.DataType, value: dict):
#可在此處存儲性能數(shù)據(jù)
print("R:", _type.value, value)
#傳入APP Bundle ID
perf.start("com.tencent.xin", callback=callback)
time.sleep(10)
perf.stop()