Playwright errors, explained one by one
Last verified
Playwright reports most failures as a JavaScript Error or TimeoutError whose message starts with the API call that failed, such as locator.click: or page.goto:, followed by the reason. In Python the same errors are raised as playwright.sync_api.Error and playwright.sync_api.TimeoutError, with the same reason text. The reason is the part you search for; the method name only tells you where it happened.
The most useful part of a Playwright error is usually not the first line. Below it, a Call log records each step Playwright took: resolving the locator, waiting for the element to be visible, enabled and stable, scrolling it into view, and checking that nothing covers it. A Timeout 30000ms exceeded headline tells you only that time ran out; the last lines of the call log tell you which condition never became true. Traces (npx playwright show-trace) add a DOM snapshot for each step.
Playwright errors fall into a few families: actionability timeouts (the element was never ready), locator problems (it matched nothing, or more than one thing), lifecycle errors (the page, frame or element you held went away), navigation errors (DNS, connection refused, slow loads), installation problems (browsers or system libraries missing), and test-runner messages from @playwright/test. Each entry below quotes the literal message, explains what it does and does not mean, and lists fixes in the order worth trying. For how Playwright compares with Selenium and Puppeteer on these failure modes, see Playwright vs Selenium vs Puppeteer.
Official reference: Playwright docs - Auto-waiting and actionability
How to read a Playwright error
A typical Playwright failure: the headline names the API and the reason, and the call log shows where waiting stopped.
TimeoutError: locator.click: Timeout 30000ms exceeded.
Call log:
- waiting for getByRole('button', { name: 'Checkout' })
- locator resolved to <button class="btn">Checkout</button>
- attempting click action
- waiting for element to be visible, enabled and stable
- element is visible, enabled and stable
- scrolling into view if needed
- done scrolling
- <div class="cookie-overlay">…</div> intercepts pointer events
- retrying click actionAll 16 messages
Jump to: Actionability & click timeouts (3) · Locators & waiting (2) · Detached elements, frames & contexts (3) · Page, context & browser lifecycle (1) · Navigation & network (3) · Installation & environment (2) · Playwright Test runner (2)
Actionability & click timeouts
| Message |
|---|
locator.click: Timeout 30000ms exceededTimeoutError: locator.click: Timeout 30000ms exceeded.
Call log:
- waiting for getByRole('button', { name: 'Submit' }) |
Element is outside of the viewportError: locator.click: Element is outside of the viewport
Call log:
- waiting for locator('#menu-item')
- attempting click action
-… |
... intercepts pointer events (retrying click action)TimeoutError: locator.click: Timeout 30000ms exceeded.
Call log:
- waiting for getByRole('button', { name: 'Checkout' })
- locator… |
Locators & waiting
| Message |
|---|
strict mode violation: locator resolved to N elementsError: locator.click: Error: strict mode violation: getByText('Sign in') resolved to 2 elements:
1) <a href="/login">Sign in</a> aka… |
waitForSelector: waiting for locator(...) to be visibleTimeoutError: page.waitForSelector: Timeout 30000ms exceeded.
Call log:
- waiting for locator('.results') to be visible |
Detached elements, frames & contexts
| Message |
|---|
Element is not attached to the DOMError: elementHandle.click: Element is not attached to the DOM |
Frame was detachedError: frame.click: Frame was detached |
Execution context was destroyed, most likely because of a navigationError: page.evaluate: Execution context was destroyed, most likely because of a navigation |
Page, context & browser lifecycle
| Message |
|---|
Target page, context or browser has been closedError: page.goto: Target page, context or browser has been closed |
Navigation & network
| Message |
|---|
page.goto: net::ERR_NAME_NOT_RESOLVEDError: page.goto: net::ERR_NAME_NOT_RESOLVED at https://exmaple.com/
Call log:
- navigating to "https://exmaple.com/", waiting until… |
page.goto: net::ERR_CONNECTION_REFUSEDError: page.goto: net::ERR_CONNECTION_REFUSED at http://localhost:3000/
Call log:
- navigating to "http://localhost:3000/", waiting… |
page.goto: Timeout 30000ms exceededTimeoutError: page.goto: Timeout 30000ms exceeded.
Call log:
- navigating to "https://example.com/", waiting until "load" |
Installation & environment
| Message |
|---|
Executable doesn't exist - please run npx playwright installError: browserType.launch: Executable doesn't exist at… |
Host system is missing dependencies to run browsersHost system is missing dependencies to run browsers.
Please install them with the following command:
sudo npx playwright install-deps |
Playwright Test runner
| Message |
|---|
expect(locator).toBeVisible() failedError: expect(locator).toBeVisible() failed
Locator: getByText('Welcome back')
Expected: visible
Timeout: 5000ms
Error: element(s) not… |
Test timeout of 30000ms exceededTest timeout of 30000ms exceeded. |
Definitions
- PlaywrightPlaywright is Microsoft's open-source browser automation framework that provides a single API to control Chrom
- Chrome DevTools Protocol (CDP)The Chrome DevTools Protocol (CDP) is the JSON-over-WebSocket interface Chrome exposes for inspecting and cont
- CSS SelectorA CSS selector is a pattern used to identify and target specific HTML elements on a web page, widely used in b
- Headless ChromeHeadless Chrome is Google Chrome running without a visible window. It renders pages and runs JavaScript like n
- IframeAn iframe (inline frame) is an HTML element that embeds a separate web page within a parent page, creating an
- Web ElementA web element is any individual component rendered on a web page — buttons, links, input fields, images, text
Playwright guides, limits and tools
Other error directories
- Cloudflare error pages errors16 messages
- Google Apps Script errors16 messages
- Google Sheets IMPORT functions errors15 messages
- HTTP errors in web scraping and automation errors15 messages
- Make (formerly Integromat) errors9 messages
- n8n errors11 messages
- Puppeteer errors15 messages
- Selenium WebDriver errors14 messages
- Zapier errors8 messages
Frequently asked questions
What is the default timeout in Playwright?
In the Playwright library, actions and navigations default to 30 seconds, changeable with page.setDefaultTimeout() and page.setDefaultNavigationTimeout(). In Playwright Test, each test has a 30-second budget, web-first assertions default to 5 seconds, and actions and navigations have no separate limit unless you set actionTimeout and navigationTimeout in the config.
How do I see why a Playwright click timed out?
Read the Call log printed under the error; its last lines show which check failed, such as element is not visible or another element intercepts pointer events. For full context, record a trace (trace: 'on-first-retry' in config) and open it with npx playwright show-trace to see DOM snapshots, network requests and console output for every step.
Should I just increase the timeout?
Usually not first. Most Playwright timeouts are caused by a locator that matches nothing, a hidden element or an overlay, and a longer timeout only makes those failures slower. Find the failing condition in the call log, fix it, and raise timeouts only for steps that are genuinely slow, such as large exports or slow third-party pages.
Is it safe to use force: true?
It skips the actionability checks, so the click is dispatched even if the element is hidden, disabled or covered. That can hide real bugs, such as a modal blocking the user, and can click the wrong element. Use it only after confirming the obstruction is cosmetic, and prefer dismissing overlays or using addLocatorHandler instead.
Why do I get errors in Python that mention Locator.click instead of locator.click?
The Python, Java and .NET bindings share the same Node.js driver, so the reason text is identical across languages; only the prefix reflects each binding's naming. Search for the part after the colon, such as Timeout 30000ms exceeded or strict mode violation, and fixes from any language apply.
What is the difference between a locator and an element handle?
A locator stores how to find an element and re-queries the page on every action, auto-waiting until it is actionable. An element handle points to one specific DOM node and goes stale when that node is removed, producing errors like Element is not attached to the DOM. Playwright's documentation recommends locators for almost all use.
Why does Playwright not use my installed Chrome?
Each Playwright version is tested against specific browser builds that it downloads into its own cache, so behavior is reproducible. That is why upgrading the package without running npx playwright install causes Executable doesn't exist. To use an installed Google Chrome or Microsoft Edge instead, launch with channel: 'chrome' or channel: 'msedge'.
How do I debug Playwright errors that only happen in CI?
Record traces and screenshots on failure, then download them as CI artifacts. Compare the Playwright version, browser build, viewport and locale between local and CI runs. Common CI-only causes are missing system dependencies, smaller default viewports in headless mode, slower hardware that exposes race conditions, and environment variables such as base URLs that are empty.
Run browser automation you can watch and take over
Autonoly runs each job in a real cloud Chromium browser driven by Playwright. Timeouts and detached elements still happen; the difference is that you can watch the run live, see the step that failed, and take control of the browser to finish it.