> ## 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.

# wait

> Pause the execution of the script for a specified duration.

<div className="replay-block">
  <iframe src="https://app.testdriver.ai/replay/68a592bd3f4291f46c418d40?share=OxDLtTuEFduInsKp8Nlqfg&embed=true&timestamp=90000&playbackRate=5" width="1000" height="350" />
</div>

```yaml highlight={5, 6} theme={null}
version: 6.0.0
steps:
  - prompt: wait for 5 seconds and type testdriver
    commands:
      - command: wait
        timeout: 5000 # 5 seconds
      - command: type
        text: testdriver
      - command: press-keys
        keys:
          - enter
```

## Description

The `wait` command pauses the execution of the script for a specified number of milliseconds before continuing. This is useful for adding delays between commands or waiting for certain conditions to stabilize.

## Arguments

| Argument  | Type     | Description                           |
| --------- | -------- | ------------------------------------- |
| `timeout` | `number` | The duration in milliseconds to wait. |

## Example usage

```yaml theme={null}
command: wait
timeout: 5000
```

## Protips

* Use the `wait` command to handle timing issues, such as waiting for animations to complete or elements to load.
* Avoid using excessively long timeouts to keep tests efficient.

## Gotchas

* Overusing the `wait` command can slow down test execution. Use it only when necessary.
* Ensure the timeout value is appropriate for the scenario to avoid unnecessary delays.

## Notes

* The `wait` command is ideal for introducing controlled pauses in your test scripts.
* Whenever you are waiting for something to load, use the [wait-for-text](/commands/wait-for-text) or [wait-for-image](/commands/wait-for-image) commands instead to make the test more efficient.
