#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
import sys
import time rebootCount = int(input("请输入测试次数:"));
print ("你输入的次数是: ", rebootCount) def copyright():
print("\n")
print("Lenovo R&T automated testing script version 0.1") def usage():
print("Usage : python " + sys.argv[0])
print(" Please turn on the device and make sure that you can use ADB Command.")
print("\n") def find_device():
# os.system('adb kill-serve')
# os.system('adb start-server')
# os.system('adb root')
# os.system('adb remount')
print("adb devices")
os.system('adb devices') def open_camera():
print("打开相机:")
os.system('adb shell am start -a android.media.action.STILL_IMAGE_CAMERA') def back():
print("返回")
os.system('adb shell input keyevent 4') def backToHome():
print("返回主页")
os.system('adb shell input keyevent 3') def menulist():
print("菜单")
os.system('adb shell input keyevent 82') def vol_up():
print("音量加")
os.system('adb shell input keyevent 24') def vol_dn():
print("音量减")
os.system('adb shell input keyevent 25') def mute():
print("扬声器静音")
os.system('adb shell input keyevent 164') def take_photo():
print("拍照")
os.system('adb shell input keyevent 27') def get_log(name,count):
os.system('adb logcat -t 50000 > '+name+count+'.log') def screen_downup():
os.system('adb shell input keyevent 26') def power_downup():
os.system('adb shell sendevent /dev/input/event0 1 116 1')
os.system('adb shell sendevent /dev/input/event0 0 0 0')
os.system('adb shell sendevent /dev/input/event0 1 116 0')
os.system('adb shell sendevent /dev/input/event0 0 0 0') E_BADARGS = 1 copyright()
usage()
find_device()
message = os.popen('adb devices').readlines()
print(message)
count=len(message) if (count < 3):
print("can't find device|找不到设备")
sys.exit(E_BADARGS)
else: #打开相机拍照
for i in range(0,rebootCount):
open_camera()
time.sleep(10)
take_photo()
time.sleep(10)
back()
count=str(i)
get_log(name="take_photo",count=count)
print("take photo finish\n") #Camera一直开,休眠唤醒屏幕
for i in range(0,rebootCount):
open_camera()
time.sleep(10)
print("screen down up")
screen_downup()
time.sleep(10)
screen_downup()
time.sleep(10)
count=str(i)
get_log(name="screen_down_up",count=count)
print("screen_down_up finish\n") #Camera一直开,模拟按power键
# for i in range(1,5):
# open_camera()
# time.sleep(10)
# print("power down up")
# power_downup()
# time.sleep(10)
# power_downup()
# time.sleep(10)
# count=str(i)
# get_log(name="power_down_up",count=count)
# print("power_down_up finish\n")
# back() #Camera一直开,模拟按音量、静音键
for i in range(0,rebootCount):
open_camera()
time.sleep(10)
print("vol up")
vol_up()
time.sleep(10)
print("vol down")
vol_dn()
time.sleep(10)
mute()
count=str(i)
get_log(name="vol_down_up",count=count)
print("vol_down_up finish\n") backToHome()
menulist()
back()

【Python】Camera拍照休眠唤醒测试的更多相关文章

  1. android Camera拍照 及 MediaRecorder录像 预览图像差90度

    Camera拍照: 今天做照相机程序,结果写好了发现出问题了,预览的图像差90度.相关源代码如下: Camera.Parameters params = camera.getParameters(); ...

  2. 详细介绍windows下使用python pylot进行网站压力测试

    windows下使用python进行网站压力测试,有两个必不可少的程序需要安装,一个是python,另一个是pylot.python是一个安装软件,用来运行python程序,而pylot则是pytho ...

  3. WINCE6.0+ILI9806E休眠唤醒显示异常问题

    我们的系统WINCE6.0,它支持睡眠和唤醒,目的是想在不使用的时候让设备进入睡眠状态,降低功耗,我们遇到的问题就是设备正常启动后正常显示,但睡眠然后唤醒后要么显示白屏要么是条纹状白屏,如下图: 图1 ...

  4. Python Web 性能和压力测试 multi-mechanize

    http://www.aikaiyuan.com/5318.html 对Web服务做Performance & Load测试,最常见的工具有Apache Benchmark俗称ab和商用工具L ...

  5. android 休眠唤醒机制分析(二) — early_suspend

    本文转自:http://blog.csdn.net/g_salamander/article/details/7982170 early_suspend是Android休眠流程的第一阶段即浅度休眠,不 ...

  6. android 休眠唤醒机制分析(一) — wake_lock

    本文转自:http://blog.csdn.net/g_salamander/article/details/7978772 Android的休眠唤醒主要基于wake_lock机制,只要系统中存在任一 ...

  7. [置顶] android系统如何在静音模式下关闭camera拍照声音(2)

    之前写过一篇“android系统如何在静音模式下关闭camera拍照声音”的博客,今天来写他的续篇,继续探讨这个问题. 公司新需求,要求在camera应用中添加一个开关,可以进行拍照声音的关闭和开启. ...

  8. Python网络数据采集7-单元测试与Selenium自动化测试

    Python网络数据采集7-单元测试与Selenium自动化测试 单元测试 Python中使用内置库unittest可完成单元测试.只要继承unittest.TestCase类,就可以实现下面的功能. ...

  9. Android开发技巧——Camera拍照功能

    本篇是我对开发项目的拍照功能过程中,对Camera拍照使用的总结.由于camera2是在api level 21(5.0.1)才引入的,而Camera到6.0仍可使用,所以暂未考虑camera2. 文 ...

随机推荐

  1. 【codeforces 757A】Gotta Catch Em' All!

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  2. asp.net core2.1 部署centos7/linux系统 -- 安装部署(一)

    原文:asp.net core2.1 部署centos7/linux系统 -- 安装部署(一) 1.安装dotnet sdk(添加产品秘钥与yum源) 添加yum源:sudo rpm -Uvh htt ...

  3. leveldb学习:Versionedit和Versionset

    VersionEdit: compact过程中会有一系列改变当前Version的操作(FileNumber添加.删除input的sstable,添加输出的sstable).为了缩小version切换的 ...

  4. gen_server笔记

    http://www.ask3.cn/a/jingcaibowen/tech/Erlang/2013/0614/42043.html gen_server是erlang的OTP框架中最常用的“行为模式 ...

  5. winfrom 操作PPT

    ///winfrom 操作PPT using System; using System.Collections.Generic; using System.Linq; using System.Tex ...

  6. 改变事件绑定的this的问题

    以标准的DOM2级事件为例,第二个参数是一个函数,咱们改成bind,看看之后的this是啥. <!DOCTYPE html> <html lang="en"> ...

  7. CentOS 挂载iso文件配置yum源

    1.挂载iso 准备好centos的光盘镜像 挂载前的准备; mkdir -p /dev/centos mkdir -p  /mnt/local_yum 挂载 mount -o loop /opt/s ...

  8. Android推送服务——百度云推送

    一.推送服务简介 消息推送,顾名思义,是由一方主动发起,而另一方与发起方以某一种方式建立连接并接收消息.在Android开发中,这里的发起方我们把它叫做推送服务器(Push Server),接收方叫做 ...

  9. PDW中的Split Querying Process

    最近看了关于 SQL Server 的分布式处理方面的论文,觉得它提出的 Polybase 跟之前看过的 HadoopDB 有些神似,这里做个小总结(抽空再把 HadoopDB 的总结贴出来). 不算 ...

  10. Focusable 属性和IsTabStop 属性之间的关系

    原文:Focusable 属性和IsTabStop 属性之间的关系 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/Libby1984/article ...