No.7 appium-Analog Keyboard

Source: Internet
Author: User
Tags appium

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.