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

  • A+
所属分类:软件测试
摘要

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

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

 

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

 

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


 

 

 

  • 我的微信
  • 加我请备注缘由
  • weinxin
  • 我的微信公众号
  • 轻松随便关注
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

关闭震动

目前评论:1   其中:访客  1   博主  0

    • avatar 旅行者 0

      来访了,