Skip to main content

SendKeysWithBT

Description

This command sends keyboard events to the Bluetooth keyboard on the device.

The device should be paired with a Bluetooth adapter in order to use this command: How to pair the device

The command is available only for users in the accessibility project.

For more details on accessibility testing, refer the following link:

Keyboard shortcuts for VoiceOver and Talkback

Parameters

NameValueDescription
KeysStringThe value should contain both modifiers and keys



Modifiers must be always specified before keys.



Example:



"" + Keys.CONTROL + Keys.SHIFT + "C"
Supported modifiers:  
Keys.SHIFT
Keys.LEFT_SHIFT
Keys.CONTROL
Keys.LEFT_CONTROL
Keys.ALT
Keys.LEFT_ALT
Keys.META
Keys.COMMAND

Supported special keys:
Keys.BACK_SPACE
Keys.TAB
Keys.RETURN
Keys.ENTER
Keys.PAUSE
Keys.ESCAPE
Keys.SPACE
Keys.PAGE_UP
Keys.PAGE_DOWN
Keys.END
Keys.HOME
Keys.LEFT
Keys.ARROW_LEFT
Keys.UP
Keys.ARROW_UP
Keys.RIGHT
Keys.ARROW_RIGHT
Keys.DOWN
Keys.ARROW_DOWN
Keys.INSERT
Keys.DELETE
Keys.SEMICOLON
Keys.EQUALS
Keys.MULTIPLY
Keys.ADD
Keys.SEPARATOR
Keys.SUBTRACT
Keys.DECIMAL
Keys.DIVIDE
Keys.F1
Keys.F2
Keys.F3
Keys.F4
Keys.F5
Keys.F6
Keys.F7
Keys.F8
Keys.F9
Keys.F10
Keys.F11
Keys.F12

Usage

Example

GetApplicationInfo

driver.executeScript("seetest:client.sendKeysWithBT", "" + Keys.CONTROL+ Keys.ALT + "I");
driver.executeScript("seetest:client.sendKeysWithBT", "" + Keys.ESC);

In case of using a programming language other than Java where the "Keys" class is not available, we can mimic the same behavior by sending the equivalent Unicode characters. Here's an example in WebDriverIO:

browser.execute("seetest:client.sendKeysWithBT", "\uE014");

In above example, we are sending the "Right Arrow" command. A full list of available Keys operations in Unicode can be found here.