Recently, if you test a music software or a video-like software, what do you do with the volume increase or fast-forward operation? Use the "Swipe" action, drag the progress bar or the volume bar 1.1-point slip? Then went to search, found that appium can send key code, simulate the operation of physical keys. Ho Ho ~ Try it ~
All right, serving!
1.keyevent(self, keycode, Metastate=none)
Sends a keycode to the device. Android only. Possible Keycodes can be
Found in http://developer.android.com/reference/android/view/KeyEvent.html.
: Args:
-Keycode-the KeyCode to is sent to the device
-Metastate-meta information about the KeyCode being sent
The approximate meaning of this API is: send a key to the device
After the key table sticky, now I try "keycode_menu":"Menu key":
Execute code:
Driver.keyevent (82)
Driver.keyevent (' 82 ')
The effect is the same
Results :
No Problem ~ "Menu key", click Finish, is this effect.
Try another type of notation:
Driver.keyevent (Keycode_menu)
result : Nameerror:name ' keycode_menu ' was not defined, error, said no definition
2.press_keycode (self, keycode, Metastate=none)
Sends a keycode to the device. Android only. Possible Keycodes can be
Found in http://developer.android.com/reference/android/view/KeyEvent.html.
: Args:
-Keycode-the KeyCode to is sent to the device
-Metastate-meta information about the keycode being sent
The approximate meaning of this API is: send a key to the device
Sad to find Press_keycode and keyevent usage is the same, do not repeat the "" "also did not find, he two what difference
3.long_press_keycode (Self, keycode, Metastate=none)
Sends a long press of keycode to the device. Android only. Possible Keycodes can be
Found in http://developer.android.com/reference/android/view/KeyEvent.html.
: Args:
-Keycode-the KeyCode to is sent to the device
-Metastate-meta information about the KeyCode being sent
The approximate meaning of this API is: send a key to the device, long press
Driver.long_press_keycode (25)
This API doesn't see what it's actually used for.
That, the key code table too long "own Baidu Bar ╮(╯▽╰)╭
The dishes are up!!
No.7 appium-Analog Keyboard