Rice University logo
 
Top blue bar image
Random notes before using Google Keep
 

Monkey from Songtao

import time

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

device = MonkeyRunner.waitForConnection()

# Touch down screen
device.touch(110, 500, MonkeyDevice.DOWN)

# Move from 100, 500 to 300, 500
for j in range(1,100):
for i in range(0, 100):
device.touch(100+j*10, 500+i*10, MonkeyDevice.MOVE)
print “move “, 100 + 20 * i, 500
time.sleep(0.001)

# Move from (300, 500 to 200, 500)
for i in range(0, 100):
device.touch(110+j*10, 500 + 100 * 10 – 10 * i, MonkeyDevice.MOVE)
print “move “, 300, 500 – 10 * i
time.sleep(0.001)

# Remove finger from screen
device.touch(300, 400, MonkeyDevice.UP)

Tags:

Comments are closed.