monkeyrunner 安装应用,卸载应用,截图功能实例代码

老虎说测试 大话测试字数 662阅读2分12秒阅读模式
摘要monkeyrunner 安装应用,卸载应用,截图功能实例代码

monkeyrunner 安装应用,卸载应用,截图功能实例代码

 文章源自陈学虎-https://chenxuehu.com/article/2017/04/6342.html

monkeyrunner 安装应用,卸载应用,截图功能实例代码。文章源自陈学虎-https://chenxuehu.com/article/2017/04/6342.html

 文章源自陈学虎-https://chenxuehu.com/article/2017/04/6342.html

from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice 

device=MonkeyRunner.waitForConnection()
if not device:
    print "Please connect a device to start!"
else:
    print "Start "

i = 1

while i<100:
    print ('this is the ' + str(i) + ' time do action')
    device.installPackage('D:\\APK\\com_qiyi_video_pad_80613.apk') 
    print ('install success')
    
    device.startActivity(component="com.qiyi.video.pad/com.qiyi.video.pad.WelcomeActivity")
    print ('start success')
    
    MonkeyRunner.sleep(5)
    
    resultt=device.takeSnapshot()
    resultt.writeToFile('d:\\test\\tmain_qiyi.png','png')
    print ('picture success')
    
    MonkeyRunner.sleep(5)
    
    device.removePackage ('com.qiyi.video.pad');
    print ('remove success')
    
    i=i+1


 文章源自陈学虎-https://chenxuehu.com/article/2017/04/6342.html

 文章源自陈学虎-https://chenxuehu.com/article/2017/04/6342.html

 文章源自陈学虎-https://chenxuehu.com/article/2017/04/6342.html 文章源自陈学虎-https://chenxuehu.com/article/2017/04/6342.html

 最后更新:2018-9-22
  • 版权声明:本文为原创文章,转载请附上原文出处链接及本声明。
  • 转载请注明:monkeyrunner 安装应用,卸载应用,截图功能实例代码 | https://chenxuehu.com/article/2017/04/6342.html