Learn this hands-on: covered in the Test automation module of our 12-week Software Testing course, with live labs and a trainer to help. See the full syllabus →

Read the call log
Error: locator.click: Timeout 30000ms exceeded.
Call log:
- waiting for getByRole('button', { name: 'Place order' })
- locator resolved to <button disabled class="btn">Place order</button>
- attempting click action
- waiting for element to be visible, enabled and stable
- element is not enabled Playwright tells you what it waited for and why it gave up. Here the button exists but stays disabled, so the real bug is earlier: a required field was not filled.
Causes and fixes
| Call log says | Fix |
|---|---|
| waiting for locator... (never resolves) | Locator wrong: use the Playwright inspector / codegen to pick one |
| element is not visible | Something covers it, it is off-screen in a closed menu, or it is the wrong match |
| element is not enabled | Previous step did not complete (validation, API call) |
| strict mode violation: resolved to 3 elements | Make the locator unique, or use .first() only if that is truly intended |
| waiting for navigation / load | Wait for a specific element or URL instead of the load event |
Fix it step by step
- Run with tracing:
npx playwright test --trace on, thennpx playwright show-trace trace.zip; step through DOM snapshots. - Rewrite locators with user-facing selectors:
page.getByRole("button", { name: "Place order" }),getByLabel,getByTestId. - Use web-first assertions that retry:
await expect(page.getByText("Order placed")).toBeVisible(). - Remove
waitForTimeout()sleeps; wait for a condition instead (waitForURL,waitForResponse). - If the app is really slow in CI, raise
expect.timeoutor the action timeout in config, and fix the slowness separately. - Mock slow third-party APIs with
page.route()where that is acceptable for the test.
Playwright config basics
// playwright.config.ts
export default defineConfig({
timeout: 30_000, // per test
expect: { timeout: 5_000 }, // per assertion
use: { trace: 'on-first-retry', screenshot: 'only-on-failure' },
retries: process.env.CI ? 2 : 0,
}); Questions
Does Playwright wait automatically?
Yes. Actions wait for elements to be attached, visible, stable, enabled and receiving events, and web-first assertions retry. That is why manual sleeps are rarely needed.
Should I just increase the timeout?
Only after checking the trace. Most timeouts are wrong locators or app states, and a longer timeout just makes failing tests slower.