#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import time
import pandas as pd
# os.system("adb reboot")
# os.system("adb wait-for-device")
f = open("./app_mCurrentFocus_20.txt","r")
lines = f.readlines()
list = []
for line in lines:
line1 = line.strip('\n')
line2 = line1.split(':',1)
app_name = line2[0]
package_name = line2[1]
appName = package_name.split('/',1)[0]
WaitTime = os.popen('''adb shell " am start -W -n %s|grep WaitTime|awk -F ':' '{print $2}'" '''%package_name).read()
time.sleep(10)
os.system("adb shell am force-stop %s"%appName)
list.append([app_name, WaitTime])
print(app_name,appName,package_name)
# mCurrentFocus = os.popen('''adb shell dumpsys window | findstr "mCurrentFocus"''').read()
# str_re = re.search('\s([\D\d]*)\s(.*?/.*?)}', mCurrentFocus)
# if str_re:
# new_str = str_re.group(2)
df=pd.DataFrame(list,columns=['app_name','WaitTime(ms)'])
df.to_excel('应用WaitTime.xlsx',index=False)
自动化测试应用WaitTime
最新推荐文章于 2021-12-22 14:47:40 发布