GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Playwright for Python
  • Docs
  • API
  • Python
  • Node.js
  • Java
  • .NET
  • Community
  • Classes
  • APIRequestContext
  • APIResponse
  • Browser
  • BrowserContext
  • BrowserType

This view

  • Original page
  • New address

GeezerVison is showing playwright.dev — TimeoutError | Playwright Python

This is unreleased documentation for Playwright Python Next version.
For up-to-date documentation, see the latest version (stable).
Version: Next
  • extends: Error

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

  • Sync
  • Async
from playwright.sync_api import sync_playwright, TimeoutError as PlaywrightTimeoutError

with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
try:
page.locator("text=Example").click(timeout=100)
except PlaywrightTimeoutError:
print("Timeout!")
browser.close()
import asyncio
from playwright.async_api import async_playwright, TimeoutError as PlaywrightTimeoutError, Playwright

async def run(playwright: Playwright):
browser = await playwright.chromium.launch()
page = await browser.new_page()
try:
await page.locator("text=Example").click(timeout=100)
except PlaywrightTimeoutError:
print("Timeout!")
await browser.close()

async def main():
async with async_playwright() as playwright:
await run(playwright)

asyncio.run(main())
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.