TimeoutError
- 継承元: Error
TimeoutError は、タイムアウトが原因で特定の操作が終了した場合に発生します。例:locator.waitFor() または 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();
})();