> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# pressKey

> Press a software keyboard key.

Presses a software keyboard key. The simplified form takes the key name as a
single string.

## Parameters

| Parameter | Type      | Required | Description                                                 |
| --------- | --------- | -------- | ----------------------------------------------------------- |
| `key`     | `enum`    | Yes      | Key to press: `enter`, `backspace`, or `close_keyboard`.    |
| `repeat`  | `number`  | No       | Number of times to press the key. Default `1`.              |
| `delay`   | `number`  | No       | Milliseconds to wait between repeated presses. Default `0`. |
| `saveAs`  | `string`  | No       | Variable to store this step's return value on `env.<name>`. |
| `retries` | `number`  | No       | Times to retry the step on failure before failing the test. |
| `skipped` | `boolean` | No       | Skip this step at execution time.                           |

## Shorthand

Key name as a single string.

```yaml theme={null}
- pressKey: enter
```

## Examples

```yaml theme={null}
- pressKey:
    key: close_keyboard # dismiss the on-screen keyboard
```

Hold a key down by repeating it with a delay, for example to clear a field:

```yaml theme={null}
- pressKey:
    key: backspace
    repeat: 12 # delete up to 12 characters
    delay: 80 # wait 80ms between presses
```

## Related

* [Test format](/core-concepts/test-format)
* [press](/reference/mobile-commands/press)
