Monkeyrunner _ coupon instance code (2)

Source: Internet
Author: User

Import sys
From Com. Android. monkeyrunner import monkeyrunner, monkeydevice
Device = monkeyrunner. waitforconnection ()

# Remove installed app coupon
Device. removepackage ('com. tu23.800.123.upon ')
Print 'remove success! '
# Install app coupon
Device. installpackage ('d:/tua0packages/androidpackag23e/coup.apk ')
Print 'Install success! '
# Start app coupon
Device. startactivity (Component = 'com. tu00.coupon/COM. tu00.coupon. Activities. Splash ')
Print 'start success! '
Monkeyrunner. Sleep (10)

# The screen is drag from page1 to start page
For I in range (1, 4 ):
Device. Drag (200,100), (5,100), 0.2, 10)
Print I
Result = device. takesnapshot ()
Result. writetofile ('e:/workspace/androidyouhuiscreenshot/shot'{str( I ?#'.png ', 'png ')

Device. Touch (150,300, monkeydevice. down_and_up)
# Get the current shot
Result = device. takesnapshot ()
# Writes the screenshot to a file
Result. writetofile ('e:/workspace/androidyouhuiscreenshot/shot11.png ', 'png ')

Monkeyrunner. Sleep (10)
# Select city Beijing
Device. Touch (150,206, 'down _ and_up ')
Monkeyrunner. Sleep (10)
# Get the current shot Beijing
Result = device. takesnapshot ()
# Writes the screenshot to a file
Result. writetofile ('e:/workspace/androidyouhuiscreenshot/beijing.png ', 'png ')
# Select city Guangzhou
# Device. Touch (150,300, 'down _ and_up ')

Related Article

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.