Small program that uses monkeyrunner to take consecutive screenshots to the android Screen

Source: Internet
Author: User
  1. #! /Home/arcticant/Android-sdks/tools/monkeyrunner
  2. From Com. Android. monkeyrunner import monkeyrunner, monkeydevice

  3. Def androidshot ():
  4. # Set the interval between two screenshot
  5. Sleeptime = 3
  6. # Connect Device
  7. Print "start ..."
  8. Device = monkeyrunner. waitforconnection ()
  9. # Begin to take Snapshot
  10. I = 0;
  11. While I <100:
  12. Result = device. takesnapshot ()
  13. Filename = STR (I) + ". PNG"
  14. Print filename
  15. Result. writetofile (filename, 'png ')
  16. Monkeyrunner. Sleep (sleeptime)
  17. I = I + 1
  18. If _ name _ = '_ main __':
  19. Androidshot ()

Monkeyrunner is required to run this script

Generally, the android-sdks folder contains monkeyrunner.
No end code is written. In ubuntu, press Ctrl + C to end the program.

Note: It is best to save this script after running it. The second run will overwrite the result generated for the first time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.