monkeyrunner学习--手机按键

按下HOME键 device.press('KEYCODE_HOME','DOWN_AND_UP')
按下BACK键 device.press('KEYCODE_BACK','DOWN_AND_UP')
按下下导航键 device.press('KEYCODE_DPAD_DOWN','DOWN_AND_UP')
按下上导航键 device.press('KEYCODE_DPAD_UP','DOWN_AND_UP')
按下OK键

device.press('KEYCODE_DPAD_CENTER','DOWN_AND_UP')

   
 

相应的按键对应的名称如下:

 

home键:KEYCODE_HOME
back键:KEYCODE_BACK
send键:KEYCODE_CALL
end键:KEYCODE_ENDCALL
上导航键:KEYCODE_DPAD_UP
下导航键:KEYCODE_DPAD_DOWN
左导航:KEYCODE_DPAD_LEFT
右导航键:KEYCODE_DPAD_RIGHT 
ok键:KEYCODE_DPAD_CENTER
上音量键:KEYCODE_VOLUME_UP 
下音量键:KEYCODE_VOLUME_DOWN
power键:KEYCODE_POWER
camera键:KEYCODE_CAMERA
menu键:KEYCODE_MENU

你可能感兴趣的:(monkeyrunner学习--手机按键)