Playwright E2E Testing Interview
Curated 20+ questions covering Playwright browser contexts, locators, auto-waiting, API routing, Trace Viewer, and parallel executions.
Difficulty Filters
Tools & Options
What is Playwright, and who maintains it?
Playwright is an open-source automation library for end-to-end testing, created and maintained by Microsoft. It supports testing web applications across Chromium, WebKit (Safari), and Firefox browsers using a single unified API in JavaScript/TypeScript, Python, Java, and C#.
What are the key advantages of Playwright over Cypress?
1. Cross-Browser Engine: Native support for WebKit (Safari engine) alongside Chromium and Firefox.
2. Multi-Page Support: Easily automate testing across multiple tabs, pages, and origins simultaneously.
3. Architecture: Communicates via browser debugging protocols (like CDPs), meaning it has no cross-origin restrictions.
4. Execution: Runs test threads in parallel out-of-the-box.
What is a Browser Context in Playwright?
A Browser Context is an isolated, incognito-like session within a browser instance. It does not share cookies, storage, or cache with other contexts. Creating browser contexts is extremely cheap (taking milliseconds), allowing developers to run hundreds of isolated test sessions in a single browser instance.
Explain Playwright Locators and the Locator API.
How does Playwright handle auto-waiting?
What is the Playwright Trace Viewer?
How do you mock API network requests in Playwright?
How do you save and reuse login state in Playwright?
Explain the difference between `page.click()` and `locator.click()`.
How do you test drag and drop in Playwright?
How do you handle multiple windows or tabs in Playwright?
What is headless mode in Playwright, and how do you configure it?
Explain soft assertions in Playwright.
What is Playwright Test Generator (Codegen)?
Explain the `test.use()` block in Playwright.
How do you wait for network requests to complete in Playwright?
What are Playwright fixtures?
How do you run tests in parallel in Playwright?
How do you test file uploads in Playwright?
What is a locator's `.nth()` and `.first()` methods?
Technical Interview Mastery Blueprint
Proven methodologies and frameworks to succeed in technical and architecture rounds.
1. The Engineering STAR Technique
When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.
2. Defending Architectural Trade-Offs
Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.
3. Clean Code & Edge-Case Proactivity
In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.
4. Antipatterns to Avoid
Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.
Explore Related Tools
Hand-picked utilities and calculators related to this tool.
