Skip to content
QA Knowledge Hub

Playwright locator timeout exceeded

Updated 2026-11-13 · 2 min read

The call log helps separate a missing node from a control that cannot receive an action. Local examples demonstrate corrected names, overlay readiness and scoped deadlines.

The reproduced message

Captured with Playwright 1.65.0 on a local fixture containing a button named Pay, while looking for Pay now:

locator.click: Timeout 500ms exceeded.
Call log:
  - waiting for getByRole('button', { name: 'Pay now', exact: true })

The 500 ms budget was deliberately short for this reproduction. It is not a recommended timeout for a checkout journey.

1. The locator or page is wrong

Read the call log and inspect the page at failure. A redirect to login or an incorrect button name cannot be repaired by a larger wait. The local fix below was run successfully:

await page.setContent('<button>Pay</button>');
await page.getByRole('button', { name: 'Pay', exact: true }).click();

On the real application, verify the URL, login setup and rendered accessible name. If the control is in an iframe, locate through the correct frame rather than searching the top-level document.

2. The element exists but cannot receive the action

A spinner may cover the button or the button may remain disabled until the user selects an address. Follow that workflow. The following local overlay wait and click were run successfully:

await page.setContent(`
  <div id="mask" style="position:fixed;inset:0;background:white">Loading</div>
  <button>Pay</button>`);
await page.locator('#mask').evaluate(el => el.remove()); // fixture simulates load completion
await page.locator('#mask').waitFor({ state: 'hidden' });
await page.getByRole('button', { name: 'Pay', exact: true }).click();

In a real test, do not remove the mask yourself: let the application finish and wait for that state. If it never finishes, investigate the request or product defect. force: true skips checks and may conceal the obstruction.

3. The wrong deadline is being changed

An action timeout, assertion timeout and overall test timeout are separate. Read the first error line to identify the one that expired. If the operation is genuinely allowed more time, set a scoped budget; this option was exercised on the local fixture:

await page.getByRole('button', { name: 'Pay', exact: true })
  .click({ timeout: 1000 });

Prevention and interview answer

Save the trace, screenshot and failed network request; choose budgets from expected behaviour rather than making every wait huge. “I use the call log to decide whether the node is absent or blocked, fix the state or locator, then review the appropriate deadline.”

Multiple matching nodes suggest strict mode violation. A disposed page suggests target closed.

Quick answers

Does locator timeout always mean the element is missing?

No. It may exist but fail an actionability check such as visibility, stability or receiving pointer events.

Why did a longer click timeout not help?

The test has its own overall timeout. It can expire before the action deadline, or the expected state may never occur.

Sources

Want a project you can show in interviews?

The portfolio project kit walks you through testing a deliberately buggy app with Selenium or Playwright and API tests, then explaining it. The app itself is free.