# -*- 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')

最新文章

  1. Ubuntu总结常用命令记录
  2. laravel select 传参
  3. 压缩文本、字节或者文件的压缩辅助类-GZipHelper 欢迎收藏
  4. 【Vijos】1431 守望者的逃离
  5. java图片处理——多张图片合成一张Gif图片并播放或Gif拆分成多张图片
  6. hdu 1536 S-Nim
  7. 字符串处理(正则表达式、NSScanner扫描、CoreParse解析器)-备用
  8. CentOS 网络设置修改
  9. Spring的IoC容器
  10. python3 第十二章 - 数据类型之List(列表)
  11. java 一维数组
  12. css常用的属性
  13. Linux C++ UDP Socket通信实例
  14. 03--css形状--css揭秘
  15. 你应该更新的 Java 知识之常用程序库【转载】
  16. 【文文殿下】P3737 [HAOI2014]遥感监测
  17. SpringCloud入门之Maven系统安装及配置
  18. Win32建立右键弹出菜单(PopMenu)
  19. android学习-进程/线程管理-完整
  20. Python爬虫框架Scrapy教程(1)—入门

热门文章

  1. 【API知识】类型转换工具ConvertUtils引发的思考
  2. 【JAVA WEB教程】jsp环境搭建+部署网站(eclipse+tomcat)【详细+图文】
  3. Go语言学习笔记(一) [Go语言的HelloWorld]
  4. Java Generator
  5. QT中全局变量的定义
  6. 后台MemoryStream图片流用ajax接收乱码问题
  7. ppt提取文字
  8. 近期ASP.NET问题汇总及对应的解决办法
  9. Docker 安装 mongoDB(五)
  10. Java坦克大战(二)