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