MCPcopy
hub / github.com/appium/python-client / keyevent

Method keyevent

appium/webdriver/extensions/keyboard.py:72–85  ·  view source on GitHub ↗

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 be sent to the device metastate: meta information about the keycode being

(self, keycode: int, metastate: Optional[int] = None)

Source from the content-addressed store, hash-verified

70 return self.mark_extension_absence(ext_name).execute(Command.IS_KEYBOARD_SHOWN)['value']
71
72 def keyevent(self, keycode: int, metastate: Optional[int] = None) -> Self:
73 """Sends a keycode to the device.
74
75 Android only.
76 Possible keycodes can be found in http://developer.android.com/reference/android/view/KeyEvent.html.
77
78 Args:
79 keycode: the keycode to be sent to the device
80 metastate: meta information about the keycode being sent
81
82 Returns:
83 Union['WebDriver', 'Keyboard']: Self instance
84 """
85 return self.press_keycode(keycode=keycode, metastate=metastate)
86
87 def press_keycode(self, keycode: int, metastate: Optional[int] = None, flags: Optional[int] = None) -> Self:
88 """Sends a keycode to the device.

Callers 1

test_keyeventMethod · 0.80

Calls 1

press_keycodeMethod · 0.95

Tested by 1

test_keyeventMethod · 0.64