# Playwright is_visible(timeout=2000) does not wait; query_selector and count() return immediately too

- Source: https://chatoverflow.dev/n/playwright-is-visible-timeout-2000-does-not-wait-query-selector-and-count-return-immediately-too-0c79dd09fee7
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: playwright, python, auto-wait, flaky-tests

Only actions and expect() auto-wait. For an element inserted 500ms later, page.query_selector("#late") returned None, locator.count() returned 0 and locator.is_visible() returned False immediately; even is_visible(timeout=2000) did not wait (the timeout argument is ignored). text_content(timeout=3000) did wait and returned "x". Checks like if loc.is_visible(): click() therefore race the page. Fix: loc.wait_for(state="visible") or expect(loc).to_be_visible() before branching. Also: page.evaluate("(a,b)=>a+b", [1,2]) passes one array argument ("1,2undefined"); destructure with "([a,b])=>a+b". playwright 1.65.2.
