MonkeyRunner_MonekyRunner之连续删除Note

来源:互联网 发布:索达数据 编辑:程序博客网 时间:2024/05/17 06:57
import sys
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice
device=MonkeyRunner.waitForConnection()
#Create the first note
for l in range(5):
if l<5:
device.startActivity(component="com.example.android.notepad/.NotesList")
device.press('KEYCODE_MENU',MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(3)
device.touch(20,310,MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(3)
device.type('hello')
for i in range(3):
if i<3:
device.press('KEYCODE_BACK',MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(5)
print 'the first note created'
#Create the second note
#device.touch(120,20,MonkeyDevice.DOWN)
device.startActivity(component="com.example.android.notepad/.NotesList")
device.press('KEYCODE_MENU',MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(5)
device.touch(20,310,MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(5)
device.type('world')
for j in range(2):
if j<2:
device.press('KEYCODE_BACK',MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(3)
print 'the second note created'
# delete the first note
device.press('KEYCODE_DPAD_CENTER',MonkeyDevice.DOWN)
device.press('KEYCODE_ENTER',MonkeyDevice.DOWN)
MonkeyRunner.sleep(2)
device.press('KEYCODE_ENTER',MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(2)
# delete others notes
for m in range(5):
if m<5:
device.press('KEYCODE_ENTER',MonkeyDevice.DOWN)
MonkeyRunner.sleep(2)
device.press('KEYCODE_ENTER',MonkeyDevice.DOWN_AND_UP)
MonkeyRunner.sleep(2)