• extends: [Error]

TimeoutError is emitted whenever certain operations are terminated due to timeout, e.g. locator.waitFor([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.locator('text=Foo').click({
timeout: 100,
});
} catch (error) {
if (error instanceof playwright.errors.TimeoutError)
console.log('Timeout!');
}
await browser.close();
})();

Hierarchy

  • Error
    • TimeoutError

Constructors

  • Parameters

    • Optional message: string
      Optional

    Returns TimeoutError

  • Parameters

    • Optional message: string
      Optional
    • Optional options: ErrorOptions
      Optional

    Returns TimeoutError

Properties

cause?: unknown
message: string
name: string
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Type declaration

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function
      Optional

    Returns void

Generated using TypeDoc