Error fixSoftware Testing · 3 min read · Updated 6 Dec 2026

Playwright "Timeout 30000ms exceeded": How to Fix

Fix Playwright "Timeout 30000ms exceeded" errors: wrong locators, hidden or disabled elements, navigation waits and slow apps. Use the trace viewer to see why.

QUICK ANSWERIn Playwright, "Timeout 30000ms exceeded" means an action or assertion kept waiting for a condition that never became true: the locator matched nothing, matched a hidden or disabled element, matched several elements in strict mode, or the page never reached the expected state. Open the trace viewer to see exactly what Playwright saw, fix the locator (prefer getByRole and getByTestId), and only then adjust timeouts.

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 →

Playwright timeout exceeded: causes and fixes
Playwright timeout exceeded: causes and fixes

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 saysFix
waiting for locator... (never resolves)Locator wrong: use the Playwright inspector / codegen to pick one
element is not visibleSomething covers it, it is off-screen in a closed menu, or it is the wrong match
element is not enabledPrevious step did not complete (validation, API call)
strict mode violation: resolved to 3 elementsMake the locator unique, or use .first() only if that is truly intended
waiting for navigation / loadWait for a specific element or URL instead of the load event

Fix it step by step

  1. Run with tracing: npx playwright test --trace on, then npx playwright show-trace trace.zip; step through DOM snapshots.
  2. Rewrite locators with user-facing selectors: page.getByRole("button", { name: "Place order" }), getByLabel, getByTestId.
  3. Use web-first assertions that retry: await expect(page.getByText("Order placed")).toBeVisible().
  4. Remove waitForTimeout() sleeps; wait for a condition instead (waitForURL, waitForResponse).
  5. If the app is really slow in CI, raise expect.timeout or the action timeout in config, and fix the slowness separately.
  6. 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.