#Python.py 如下--------------------------------
#Function: test dictionary paocitiao
#Copyright: Yvan Wang
# 2012-02-08
#---------------------------------------------
#Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
#Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
#obtain device connection
if not device:
print >> sys.stderr,"device connection is fail"
sys.exit(1)
pause = 1.0
Num = 1000000
for i in range(1,Num):
try:
#get start screen
result = device.takeSnapshot()
result.writeToFile('./result1.png','png');
device.press('KEYCODE_PAGE_DOWN')
MonkeyRunner.sleep(pause)
#get end screen
result2 = device.takeSnapshot()
result2.writeToFile('./result2.png','png');
except ValueError:
print("Oops! That was no valid number. Try again...")
continue
#compare picture
flag = result2.sameAs(result,1.0)
#The bottom of list ' Msbox
if (flag == True):
MonkeyRunner.alert('The bottom of list!','result message','OK')