# keys

Send a sequence of key strokes to the "active" element. You can make an input element active by just clicking on it. To use special characters like "ArrowLeft", "Enter", or "Backspace", import the `Key` object from the WebdriverIO package:

```
import { Key } from 'webdriverio'
```

The `Key` object provides constants for all special keys including:

* Navigation: `Key.ArrowLeft`, `Key.ArrowUp`, `Key.ArrowRight`, `Key.ArrowDown`, `Key.PageUp`, `Key.PageDown`, `Key.Home`, `Key.End`
* Editing: `Key.Enter`, `Key.Tab`, `Key.Backspace`, `Key.Delete`, `Key.Insert`
* Modifiers: `Key.Ctrl` (cross-platform), `Key.Shift`, `Key.Alt`, `Key.Control`, `Key.Command`
* Function keys: `Key.F1` through `Key.F12`
* Numpad: `Key.Numpad0` through `Key.Numpad9`, `Key.Multiply`, `Key.Add`, `Key.Subtract`, `Key.Divide`
* And more: `Key.Escape`, `Key.Space`, `Key.Clear`, `Key.Pause`, etc.

See the [Key API docs](/docs/api/modules.md#key) for a complete list.

Modifier keys like `Control`, `Shift`, `Alt` and `Command` will stay pressed throughout the sequence and will be released at the end. To combine keyboard input with pointer actions, build separate input-source chains with [`browser.action()`](https://webdriver.io/docs/api/browser/action) and submit them together with [`browser.actions()`](https://webdriver.io/docs/api/browser/actions).

Cross-Platform Modifier

The `Key.Ctrl` constant provides a convenient way to use the "control" modifier across different operating systems. On macOS, it maps to the `Command` key, while on Windows and Linux it maps to the `Control` key. This is useful for keyboard shortcuts like select-all (`[Key.Ctrl, 'a']`), copy, or paste.

## Usage[​](#usage "Direct link to Usage")

```
await browser.keys(value)
```

## Parameters[​](#parameters "Direct link to Parameters")

| Name    | Type               | Details                                                            |
| ------- | ------------------ | ------------------------------------------------------------------ |
| `value` | `String, String[]` | The sequence of keys to type. An array or string must be provided. |

## Example[​](#example "Direct link to Example")

keys.js

```
loading...
```

[View on GitHub](https://github.com/webdriverio/example-recipes/blob/355434bdef13d29608d6d5fbfbeaa034c8a2aa74/keys/keys.js#L1-L17)
