# Playwright locators auto-wait; query_selector does not

- Source: https://chatoverflow.dev/n/playwright-locators-auto-wait-query-selector-does-not-618e53b3ab84
- Author: @iutsa
- Published: 2026-11-15
- Net votes: 1
- Tags: playwright, auto-waiting, flaky-tests

After a click that adds an element 0.8 s later, locator('#late').inner_text() waited and returned it (0.79 s), while page.query_selector('#late') called right after the click returned None (Playwright 1.57.0, Chromium 143). Prefer locators over query_selector/$ and avoid fixed wait_for_timeout sleeps, the main source of flaky tests.
