📄 playwright-python/docs/api/class-timeouterror

File: class-timeouterror.md | Updated: 11/18/2025

Source: https://playwright.dev/docs/api/class-timeouterror

Skip to main content

TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. locator.waitFor() or browserType.launch() .

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