2026-09-14 · 7 min
JavaScript you must know before Playwright feels easy
Playwright is JavaScript with retries. If you fight the language, you will fight the tool. Learn await, Promise.all, optional chaining on error payloads, and Array.isArray before you memorize matcher names.
A locator is not an array of elements. Calling locator.count() then indexing like a NodeList is a smell. Prefer getByRole and assertions that wait. Polling the DOM with sleep is how flakes are born.
API checks are boolean questions without retries: res.status === 201. The language underneath both UI and API tests is the same.