Android Test KeyCode

Source: Internet
Author: User

Problem:

Yesterday to do test case, found an online game apk run interface, Uiautomator can not capture access.

As a result, the input has to use (Dut.onclick (int a, int y)) coordinate click Method to enter the user name and password.

Can not have the adaptability of the screen, but also make the input code complex, error-prone.

Workaround: Use the Uidevice.getinstance (). Presskeycode (int x) method

String id= "Inteltest"; for (int i=0;i<id.length (); i++) {char c =id.charat (i); if (c >=48&&c <=57) { Uidevice.getinstance (). Presskeycode (c-41);} ElseIf (c >=97&&c <=122) {uidevice.getinstance (). Presskeycode (c-68);} ElseIf (c >=65&&c <=90) {uidevice.getinstance (). Presskeycode (); Sleep (20); Uidevice.getinstance (). Presskeycode (c-36);} else if (c ==32) {uidevice.getinstance (). Presskeycode (62);} else{}}

KeyCode:

KeyCode 1 = left mouse button
KeyCode 2 = right mouse button
KeyCode 3 = Cancel
KeyCode 4 = middle mouse button
KeyCode 8 = BackSpace
KeyCode 9 = Tab
KeyCode = Clear (unknown)
KeyCode = Enter
KeyCode = shift_l
KeyCode = control_l
KeyCode = alt_l
KeyCode = Pause
KeyCode = Caps_lock
KeyCode = Escape
KeyCode = Space
KeyCode = Prior (PageUp key)
KeyCode = Next (PageDown key)
KeyCode = End
KeyCode = Home
KeyCode PNs = Left
KeyCode = up
KeyCode = Right
KeyCode = Down
KeyCode x = Select (unknown)
KeyCode = Print (printscreen key)
KeyCode = Execute (unknown)
KeyCode = Insert
KeyCode = Delete
KeyCode = Help (unknown)
keycode = 0 Equal braceright
keycode = 1 Exclam onesuperior
KeyCode = 2 Quotedbl twosuperior
keycode = 3 section Threesuperior
keycode = 4 Dollar
KeyCode = 5 percent
KeyCode = 6 Ampersand
keycode = 7 Slash braceleft
KeyCode = 8 Parenleft bracketleft
KeyCode = 9 Parenright bracketright
KeyCode = a A
KeyCode = b b
KeyCode = c C
KeyCode = d D
KeyCode = e e eurosign
KeyCode = f F
KeyCode = g g
KeyCode = h H
KeyCode = i I
KeyCode = J J
KeyCode = k K
KeyCode = l l
keycode = M M mu
KeyCode = n N
keycode = o O
KeyCode = P p
KeyCode Bayi = q q at
KeyCode = r R
KeyCode = s S
KeyCode = t T
KeyCode = u u
KeyCode = v V
KeyCode = w W
KeyCode = x x
KeyCode = y y
KeyCode = Z Z
KeyCode = Kp_0 kp_0 (numpad number 0)
KeyCode = kp_1 kp_1 (numpad number 1)
KeyCode 98 = kp_2 kp_2 (keypad number 2)
KeyCode = Kp_3 Kp_3 (numpad number 3)
KeyCode = Kp_4 Kp_4 (numpad number 4)
KeyCode 101 = kp_5 Kp_5 (keypad number 5)
KeyCode 102 = kp_6 Kp_6 (keypad number 6)
KeyCode 103 = kp_7 kp_7 (keypad number 7)
KeyCode 104 = kp_8 Kp_8 (keypad number 8)
KeyCode = Kp_9 Kp_9 (numpad number 9)
KeyCode 106 = kp_multiply kp_multiply (keypad multiply)
KeyCode 107 = Kp_add Kp_add (keypad plus)
KeyCode 108 = kp_separator kp_separator (keypad enter)
KeyCode 109 = kp_subtract kp_subtract (keypad minus)
KeyCode = Kp_decimal kp_decimal (keypad decimal)
KeyCode 111 = kp_divide kp_divide (keypad except)
KeyCode = F1
KeyCode 113 = F2
KeyCode = F3
KeyCode = F4
KeyCode = F5
KeyCode 117 = F6
KeyCode 118 = F7
KeyCode 119 = F8
KeyCode = F9
KeyCode 121 = F10
KeyCode 122 = F11
KeyCode 123 = F12
KeyCode 124 = F13
KeyCode = F14
KeyCode 126 = F15
KeyCode 127 = F16
KeyCode = F17
KeyCode 129 = F18
KeyCode = F19
KeyCode 131 = F20
KeyCode = F21
KeyCode 133 = F22
KeyCode 134 = F23
KeyCode 135 = F24
KeyCode 136 = Num_lock
KeyCode 137 = Scroll_lock (unknown)
KeyCode 187 = Acute Grave (unknown)
KeyCode 188 = comma semicolon (unknown) (comma semicolon)
KeyCode 189 = minus underscore (minus underline)
keycode = period colon (unknown colon)
KeyCode 192 = numbersign apostrophe (Unknown single quotation mark)
KeyCode = Plusminus hyphen Macron (Unknown & ^)
KeyCode 211 =
KeyCode 212 = Copyright registered (unknown)
KeyCode 213 = Guillemotleft Guillemotright (unknown)
KeyCode 214 = masculine ordfeminine (unknown)
KeyCode 215 = AE AE (unknown)
KeyCode 216 = cent yen (unknown)
KeyCode 217 = Questiondown Exclamdown (unknown)
KeyCode 218 = Onequarter Onehalf threequarters (unknown)
KeyCode = less greater bar (lesser than number greater than unknown)
KeyCode 221 = plus asterisk Asciitilde (plus asterisk unknown)
KeyCode 227 = Multiply Division (multiplication)
KeyCode 228 = Acircumflex Acircumflex (unknown)
KeyCode 229 = Ecircumflex Ecircumflex (unknown)
KeyCode = Icircumflex Icircumflex (unknown)
KeyCode 231 = Ocircumflex Ocircumflex (unknown)
KeyCode 232 = Ucircumflex Ucircumflex (unknown)
KeyCode 233 = Ntilde Ntilde (unknown)
KeyCode 234 = Yacute Yacute (unknown)
KeyCode 235 = Oslash Ooblique (unknown)
KeyCode 236 = aring aring (unknown)
KeyCode 237 = Ccedilla Ccedilla (unknown)
KeyCode 238 = Thorn Thorn (unknown)
KeyCode 239 = ETH eth (unknown)
KeyCode = diaeresis cedilla currency (unknown)
KeyCode 241 = Agrave agrave Atilde Atilde (unknown)
KeyCode 242 = Egrave Egrave (unknown)
KeyCode 243 = Igrave Igrave (unknown)
KeyCode 244 = Ograve ograve Otilde Otilde (unknown)
KeyCode 245 = Ugrave Ugrave (unknown)
KeyCode 246 = Adiaeresis adiaeresis (unknown)
KeyCode 247 = Ediaeresis ediaeresis (unknown)
KeyCode 248 = Idiaeresis idiaeresis (unknown)
KeyCode 249 = odiaeresis Odiaeresis (unknown)
KeyCode = Udiaeresis udiaeresis (unknown)
KeyCode 251 = ssharp question backslash (unknown)
KeyCode 252 = Asciicircum degree (unknown)
KeyCode 253 = 3 Sterling (unknown)
KeyCode 254 = Mode_switch (unknown)

Ascii:

Android Test KeyCode

Related Article

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.