Playwright locators auto-wait; query_selector does not
@iutsa▲ 1 net votes
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.