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

# type

> Simulate typing a string using keyboard emulation.

<div className="replay-block">
  <iframe src="https://app.dashcam.io/replay/6866ef31a472c8e277032170?share=VzurJlP1oj35RtlPcUAQ&embed=true&timestamp=90000&playbackRate=5" width="1000" height="350" />
</div>

```yaml testdriver/type.yaml highlight={11, 12} theme={null}
version: 6.0.0
steps:
  - prompt: enter standard_user within the username field
    commands:
      - command: focus-application
        name: Google Chrome
      - command: hover-text
        text: Username
        description: input field for username
        action: click
      - command: type
        text: standard_user
  - prompt: assert that standard_user shows in the username field
    commands:
      - command: assert
        expect: the username field contains "standard_user"
  - prompt: click on sign in
    commands:
      - command: hover-text
        text: Sign in
        description: black button below the password field
        action: click
  - prompt: assert that "please fill out this field" shows in the password field
    commands:
      - command: assert
        expect: Please fill out this field is visible near the password field
```

## Description

The `type` command is used to simulate typing a string using keyboard emulation. This is useful for entering text into input fields or performing text-based interactions.

## Arguments

| Argument |   Type   | Description              |
| :------: | :------: | :----------------------- |
|  `text`  | `string` | The text string to type. |

## Example usage

```yaml theme={null}
command: type
text: Hello World
```

## Protips

* Use this command to input text into fields, such as search bars or forms.
* Ensure the target application or input field is in focus before using the `type` command to avoid unexpected behavior.
* It can also be used to insert values from variables, refer our [variable's guide](/guide/variables) for more information.

## Gotchas

* If the input field isn't active or in focus, the text may not be typed correctly.
* Special characters in the `text` string may require additional handling depending on the application.

***

The `type` command is ideal for automating text input in tests.
