# LibTmux.Pane.WaitForTextAsync

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** C#
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/cf34b255c896d19a97e7d7fabea58609c916012d/src/LibTmux/Pane.Waiting.cs#L25
- **Page:** https://libtmux.org/en/csharp/latest/reference/libtmux-pane-waitfortextasync/

```
LibTmux.Pane.WaitForTextAsync(text: string, timeout: TimeSpan, cancellationToken: CancellationToken) -> Task<PaneWaitResult>

LibTmux.Pane.WaitForTextAsync(request: PaneWaitRequest, cancellationToken: CancellationToken) -> Task<PaneWaitResult>
```

Waits until the pane shows literal text.

Text already on screen ends the wait at once as
<see cref="PaneWaitOutcome.PresentAtEntry" />. Matching is line by line,
so the text cannot span lines.

## Parameters

- `text` (`string`): The text to wait for, matched within a line. (for `WaitForTextAsync(text, timeout, cancellationToken)`)
- `timeout` (`TimeSpan`): How long to wait. (for `WaitForTextAsync(text, timeout, cancellationToken)`)
- `cancellationToken` (`CancellationToken`): Stops the wait.
- `request` (`PaneWaitRequest`): The patterns and time allowed. (for `WaitForTextAsync(request, cancellationToken)`)

## Returns

How the wait ended.

## Raises

- [`ArgumentException`](https://learn.microsoft.com/dotnet/api/system.argumentexception): The text is empty or contains a line break. (for `WaitForTextAsync(text, timeout, cancellationToken)`)
- [`ArgumentOutOfRangeException`](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception): The timeout is negative or longer than 49 days.
- [`TmuxTransportException`](/en/csharp/latest/reference/libtmux-tmuxtransportexception/): Control observation failed and polling was not enabled.
- [`TmuxObjectNotFoundException`](/en/csharp/latest/reference/libtmux-tmuxobjectnotfoundexception/): tmux no longer has the pane when the wait begins.
- [`RegexMatchTimeoutException`](https://learn.microsoft.com/dotnet/api/system.text.regularexpressions.regexmatchtimeoutexception): A pattern exceeded its own match timeout. (for `WaitForTextAsync(request, cancellationToken)`)
