longPressKeyCode
Press and hold a particular key code on the device.
Note: Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the
mobile:execute method.
Usage
browser.longPressKeyCode(keycode, metastate, flags)
Parameters
| Name | Type | Details |
|---|---|---|
keycode | number | The keycode to long-press (Android KeyEvent constant) |
metastateoptional | number | Meta state to apply during the key press (e.g. shift, ctrl) |
flagsoptional | number | Integer flags for the key event |
Example
longPressKeyCode.js
it('should long press the Home button', async () => {
await browser.longPressKeyCode(3)
})
Support
ملاحظة
Refer to the official Appium driver documentation to see which driver versions support this command.