Simulates pressing a single key on the keyboard. Accepts key names like “Enter”, “Backspace”, “ArrowLeft”, or single characters like “a”, “5”. Example: keyPress(key: "Enter") Returns true if the key press was successful.

Definition

keyPress(
  key: String!
  options: KeyPressOptions
): Boolean!

Arguments

key: String!

The key to press. For a list of possible keys, refer to MDN documentation on KeyboardEvent.key. Examples: "a", "Enter", "F1", "Control", "Shift+A" (modifiers are handled by ‘options’ or within the key string for some systems). For combinations like Ctrl+C, usually use individual presses or type for text.

options: KeyPressOptions

Options for the key press, such as delay.

Returns

Boolean!

The Boolean scalar type represents true or false.