Testing / Playwright Interview questions
Explain the internal working of Playwright's browser automation?
Rather than driving browsers through the WebDriver protocol like Selenium, Playwright ships small, patched builds of Chromium, Firefox, and WebKit and talks to each one over its own native automation protocol - DevTools Protocol-derived for Chromium, and dedicated protocols the Playwright team built directly into patched Firefox and WebKit builds.
When a test calls an API like page.click(), the language binding (Node.js, Python, etc.) serializes that call and sends it to a Node.js driver process, which forwards it over the browser's protocol connection to the actual browser process.
sequenceDiagram
participant T as Test Script
participant D as Playwright Driver
participant B as Browser Process
T->>D: page.click(selector)
D->>B: Protocol command
B-->>D: Actionability + result
D-->>T: Resolved promise
This out-of-process, protocol-level connection is what gives Playwright fine-grained visibility into network requests, console messages, and dialogs as they happen, rather than only being able to react to them through JavaScript injected into the page, which is the more limited approach older automation tools were built around.
More Related questions...