# repeat

The repeat command is used to run a set of commands multiple times.

## Examples

You must specify `times` or `while` and the `commands` option.

### Repeating commands X times

To repeat 10 times:

```yaml
- repeat:
    times: 10
    commands:
      - tapOn:
          text: "load more"
      - scrollUntilVisible:
          element:
            text: "load more"
```

### Repeating while a condition is true

To keep repeating while an element is `visible` , `notVisible` or `true`:

```yaml
- repeat:
    while:
      notVisible:
        text: "no more results"
    commands:
      - scroll
```

```yaml
- repeat:
    while:
      visible:
        id: "next-label"
    commands:
      - swipe
        direction: RIGHT
```

```yaml
- repeat:
    while:
      true: ${MY_KEY == 'my value'}
    commands:
      - scroll
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.moropo.com/creating-tests/commands/repeat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
