I'm using MonkeyRunner to play with simulation of user activity. All fine but I cannot press EndCall. To make call I use:
device.touch(190, 800, 'DOWN_AND_UP')
x,y coordinates of CALL button.
But when I trying to hangup I try :
device.touch(230, 700, 'DOWN_AND_UP')
x,y - accordingly coordinates of End Call button. Nothing happen.Trying press:
device.press('KEYCODE_ENDCALL', 'DOWN_AND_UP')
Same effect. Trying now to send intent but dont know which intent to use to EndCall. My d开发者_开发技巧evice running on Android 2.2.1.
Thanks.
This works on an emulator with 2.3 and WVGA:
#! /usr/bin/env monkeyrunner
from com.android.monkeyrunner import MonkeyRunner
def main():
print "waiting for connection..."
device = MonkeyRunner.waitForConnection()
device.touch(140, 760)
MonkeyRunner.sleep(15)
print "dialing..."
device.type('5551234')
MonkeyRunner.sleep(3)
device.touch(240, 740)
MonkeyRunner.sleep(25)
print "hanging up..."
device.touch(240, 600)
if __name__ == '__main__':
main()
you can use
device.press('KEYCODE_MENU', 'DOWN_AND_UP')
instead of
device.press('KEYCODE_ENDCALL', 'DOWN_AND_UP')
After that by the help of arrow key u can move up, down, right and left and go to the END CALL Button and click on it using
device.press('KEYCODE_ENTER', 'DOWN_AND_UP')
.
精彩评论