# Keyboard

Source: https://docs.scrappey.com/docs/keyboard

> Simulate specific keyboard actions during your scraping session, useful for navigation, form control, or clearing fields.

## Command

`"keyboard"`

This browser action triggers a specific key press event, such as `Enter`, `Tab`, or `ArrowDown`, optionally on a selected element.

## Parameters

| Parameter     | Type   | Required | Description                                                                                                                                        |
| ------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `value`       | string | Yes      | The keyboard action to simulate. Must be one of: `tab`, `enter`, `space`, `arrowdown`, `arrowup`, `arrowleft`, `arrowright`, `backspace`, `clear`. |
| `cssSelector` | string | No       | Required only when using `clear`. Specifies which element the action applies to.                                                                   |

## Supported `value` Options

| Action       | Description                                                 |
| ------------ | ----------------------------------------------------------- |
| `tab`        | Simulates pressing the Tab key                              |
| `enter`      | Simulates pressing Enter                                    |
| `space`      | Simulates pressing Spacebar                                 |
| `arrowdown`  | Scrolls or moves focus down                                 |
| `arrowup`    | Scrolls or moves focus up                                   |
| `arrowleft`  | Moves cursor/focus left                                     |
| `arrowright` | Moves cursor/focus right                                    |
| `backspace`  | Deletes one character                                       |
| `clear`      | Clears the value of an input field (requires `cssSelector`) |

## Example

```bash
curl -X POST "https://publisher.scrappey.com/api/v1?key=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cmd": "request.get",
    "url": "https://example.com",
    "browserActions": [
      {
        "type": "keyboard",
        "value": "enter"
      }
    ]
  }'
```

## Notes

* Submit a form using `enter` after typing into an input field.
* Navigate a dropdown or form with `tab` and `arrow` keys.
* Clear a field before typing a new value using `clear`.
* Combine with `type`, `click`, or `wait` for more natural form interactions.
* Make sure the `cssSelector` targets an interactive or input element when using `clear`.
