Skip to main content
Version: 1.15

TimeoutError

TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. page.waitForSelector(selector[, options]) or browserType.launch([options]).

const playwright = require('playwright');
(async () => {  const browser = await playwright.chromium.launch();  const context = await browser.newContext();  const page = await context.newPage();  try {    await page.click("text=Foo", {      timeout: 100,    })  } catch (error) {    if (error instanceof playwright.errors.TimeoutError)      console.log("Timeout!")  }  await browser.close();})();