【Android自动化】测试android手机唤醒性能测试
2024-08-31 06:44:10
# -*- coding:utf-8 -*-
import time
import os
import common.common
from common.getconfigs import GetConfigs
from uiautomator import device as d cfg = GetConfigs('11_unlockscreen')
dict_times = cfg.get_test_times() def CheckPhoneStatus():
"""
Check the phone status first,if it not in suspend mode,will enter the suspend mode first and start the test. """
if d(packageName = 'com.tct.launcher',description = 'Apps').exists:
print 'The phone isn\'t in suspend mode,will lock it first'
LockPhone() def UnlockPhone():
"""
Unlock the phone and check the phone whether enter the homepage base on the ALL Apps icon """
d.wakeup()
time.sleep(1)
if d(resourceId='com.android.systemui:id/lock_icon').exists:
d.swipe(397, 1165, 500, 500, steps=5)
time.sleep(1)
if d(description='Apps').exists:
print 'unlock successfully'
else:
print 'itn\'t unlock'
else:
print 'The phone unlock failed' def LockPhone():
d.press('power') def Run(key):
times = int(dict_times.get(key.lower(),0))
CheckPhoneStatus()
for i in range(times):
UnlockPhone()
time.sleep(2)
LockPhone()
time.sleep(2)
print i if __name__ == '__main__':
Run('Lock')
最新文章
- Ubuntu总结常用命令记录
- laravel select 传参
- 压缩文本、字节或者文件的压缩辅助类-GZipHelper 欢迎收藏
- 【Vijos】1431 守望者的逃离
- java图片处理——多张图片合成一张Gif图片并播放或Gif拆分成多张图片
- hdu 1536 S-Nim
- 字符串处理(正则表达式、NSScanner扫描、CoreParse解析器)-备用
- CentOS 网络设置修改
- Spring的IoC容器
- python3 第十二章 - 数据类型之List(列表)
- java 一维数组
- css常用的属性
- Linux C++ UDP Socket通信实例
- 03--css形状--css揭秘
- 你应该更新的 Java 知识之常用程序库【转载】
- 【文文殿下】P3737 [HAOI2014]遥感监测
- SpringCloud入门之Maven系统安装及配置
- Win32建立右键弹出菜单(PopMenu)
- android学习-进程/线程管理-完整
- Python爬虫框架Scrapy教程(1)—入门