Skip to main content

TimeoutError

  • extends: [Error]

TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. Locator.WaitForAsync(options) or BrowserType.LaunchAsync(options).

using Microsoft.Playwright;

using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync();
var page = await browser.NewPageAsync();
try
{
await page.ClickAsync("text=Example", new() { Timeout = 100 });
}
catch (TimeoutException)
{
Console.WriteLine("Timeout!");
}