# LibTmux.Pane.SendTextAndWaitAsync

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

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

Types a line, presses Enter, and waits for a later line to contain the text.

<see cref="SendKeysAndWaitAsync" /> with <see cref="SendTextAsync" />'s
keys: the screen before the line is typed never ends the wait, and the
line's echo is discounted. The typed line may be at most 65536 UTF-8
bytes so echo projection fits within the wait's work budget.

## Parameters

- `line` (`string`): The line to type, sent verbatim.
- `text` (`string`): The text to wait for, matched literally.
- `timeout` (`TimeSpan`): How long to wait, counted from the call.
- `cancellationToken` (`CancellationToken`): Stops the wait; a line already sent stays sent.

## Returns

How the wait ended.

## Raises

- [`ArgumentNullException`](https://learn.microsoft.com/dotnet/api/system.argumentnullexception): <paramref name="line" /> is null.
- [`ArgumentException`](https://learn.microsoft.com/dotnet/api/system.argumentexception): The match text is empty or spans lines, or the typed line exceeds 65536 UTF-8 bytes.
- [`ArgumentOutOfRangeException`](https://learn.microsoft.com/dotnet/api/system.argumentoutofrangeexception): The timeout is negative or longer than 49 days.
- [`IOException`](https://learn.microsoft.com/dotnet/api/system.io.ioexception): Echo projection exceeds its bounded work.
- [`RegexMatchTimeoutException`](https://learn.microsoft.com/dotnet/api/system.text.regularexpressions.regexmatchtimeoutexception): Echo matching exceeds its finite regex time.
- [`TmuxPaneException`](/en/csharp/latest/reference/libtmux-tmuxpaneexception/): The pane's program had already exited, or the pane changed during every read until the timeout, so nothing was sent.
- [`TmuxObjectNotFoundException`](/en/csharp/latest/reference/libtmux-tmuxobjectnotfoundexception/): tmux no longer has the pane.
- [`LibTmuxException`](/en/csharp/latest/reference/libtmux-libtmuxexception/): The line was typed but Enter failed. The pane may already have acted
on it; do not retry the whole call.
