本章主要介绍touch事件
void touch ( integer x, integer y, string type)
Sends a touch event specified by type to the screen location specified by x and y.
Arguments
x | The horizontal position of the touch in actual device pixels, starting from the left of the screen in its current orientation. |
---|---|
y | The vertical position of the touch in actual device pixels, starting from the top of the screen in its current orientation. |
type | The type of key event to send. The allowed values are DOWN , UP , and DOWN_AND_UP . |
string DOWN
string UP
string DOWN_AND_UP
例子:
for i in range(200):
device.touch(100,600,"DOWN_AND_UP")
MonkeyRunner.sleep(5)
device.touch(240,750,"DOWN")
MonkeyRunner.sleep(5)
device.touch(400,750,"UP")
MonkeyRunner.sleep(5)