Playwright Interview Questions (2026)

Playwright interview questions test browser automation skill across locators, auto-waiting, assertions, browser contexts, fixtures, traces, parallel runs, and CI debugging.

45 questions with answers

What Is Playwright?

Key Takeaways

  • Playwright is a browser automation and testing framework for Chromium, Firefox, and WebKit.
  • Interviewers ask about locators, auto-waiting, assertions, browser contexts, fixtures, traces, and parallel execution.
  • Strong answers use user-facing locators and explain why the assertion proves the workflow.
  • Playwright tests can cover browser flows and API setup, which makes test setup faster and cleaner.

Playwright is a testing framework for automating modern web apps across Chromium, Firefox, and WebKit. It is commonly used with TypeScript or JavaScript, but also supports Python, Java, and .NET. In interviews, Playwright questions check whether you can write stable browser tests, isolate state with contexts, debug failures with traces, and run suites in CI without hiding flaky behavior.

45Playwright questions with direct answers
3 enginesChromium, Firefox, WebKit
TraceCommon debugging artifact
TS/JSMost common interview language

Watch: Get started with end to end testing: Playwright

Video: Get started with end to end testing: Playwright (Microsoft Developer, YouTube)

Test yourself and earn a certificate

6 quick questions. Score 70%+ to download your Playwright certificate.

Jump to quiz

All Questions on This Page

45 questions
Playwright Advanced Scenarios
  1. 31. A locator matches two buttons. What does Playwright do?
  2. 32. A test passes in Chromium but fails in WebKit. What do you check?
  3. 33. Trace shows a button is covered by a spinner. What is the fix?
  4. 34. Tests fail in parallel when sharing one account. What do you change?
  5. 35. Generated code uses brittle selectors. What do you do?
  6. 36. A CI failure has no trace. What do you improve?
  7. 37. API setup skips the UI path. Is that okay?
  8. 38. A test fails due to slow API response. What do you inspect?
  9. 39. beforeEach creates lots of unused data. What is the issue?
  10. 40. When are retries acceptable?
  11. 41. A page object hides every assertion. What is the risk?
  12. 42. How do you test file download?
  13. 43. How do you test a new tab in Playwright?
  14. 44. A Playwright suite is too slow. What do you change?
  15. 45. What makes a Playwright answer senior?

Playwright Fundamentals

Foundational15 questions

Start here. These are the definitions and first-principle checks that open most rounds.

Q1. What is Playwright used for?

Playwright is used for browser automation and web app testing across Chromium, Firefox, and WebKit.

It supports TypeScript, JavaScript, Python, Java, and .NET.

Playwright changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Watch a deeper explanation

Video: Playwright Automation Tutorial for Beginners (LambdaTest, YouTube)

Q2. What is a browser object in Playwright?

A browser object represents a launched browser engine instance.

It can create isolated browser contexts.

browser changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q3. What is a browser context?

A browser context is an isolated browser session with its own cookies, storage, permissions, and pages.

Contexts help run tests independently.

browser context changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q4. What is a page in Playwright?

A page represents a single browser tab or page inside a context.

Most user actions and assertions happen through page or locator objects.

page changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Answer partWhat to sayEvidence to mention
Definitionpage in one direct sentence.Official docs or course material
Use caseThe work where it changes a decision.Dataset, model, query, dashboard, or pipeline
RiskWhat breaks when it is misunderstood.Metric, log, test result, or review note

Q5. What is a locator?

A locator finds elements and performs actions with built-in waiting and retry behavior.

Prefer user-facing locators before brittle CSS or XPath.

locator changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Watch a deeper explanation

Video: Playwright Beginner Tutorial (Automation Step by Step, YouTube)

Q6. Why is getByRole useful?

getByRole locates elements by accessible role and name.

It aligns tests with how users and assistive technology understand the page.

getByRole changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q7. What is auto-waiting in Playwright?

Playwright waits for elements to be actionable before actions such as click or fill.

It checks visibility, stability, enabled state, and event receiving where relevant.

auto-waiting changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Actionability flow

1Resolve
find locator
2Check
visible and stable
3Act
click or fill
4Assert
expected result

Q8. Why use Playwright expect assertions?

Expect assertions wait for expected UI or state conditions before failing.

They reduce manual waiting and make intent clear.

expect assertions changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q9. What are fixtures in Playwright Test?

Fixtures provide reusable setup and teardown for tests.

They can create pages, data, logged-in state, or services.

fixtures changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q10. What are Playwright projects?

Projects define different test configurations such as browser, viewport, locale, or device.

They make cross-browser and mobile viewport runs manageable.

projects changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q11. What is storage state?

Storage state stores cookies and local storage for reuse across tests.

It is commonly used to avoid logging in through UI for every test.

storage state changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q12. What is Playwright trace viewer?

Trace viewer shows actions, snapshots, network, console, and timing from a test run.

It is one of the best artifacts for CI failure triage.

trace viewer changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q13. What is APIRequestContext used for?

APIRequestContext sends API requests from Playwright tests.

It is useful for setup, teardown, and API assertions.

APIRequestContext changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Watch a deeper explanation

Video: Playwright Automation Using TypeScript (The Testing Academy, YouTube)

Q14. How does Playwright support parallel execution?

Playwright Test can run files or tests across workers based on configuration.

Parallel tests need isolated data and state.

parallel execution changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q15. How should you use Playwright code generation?

Use code generation as a starting point, then clean locators, assertions, and test structure.

Generated code is not final test design.

test generator changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Back to question list

Playwright Practical Interview Questions

Intermediate15 questions

These questions test whether you can apply the topic to real data, real code, and messy constraints.

Q16. How would you write a Playwright login test?

Open login, fill fields using labels, submit, then assert a logged-in signal.

Use role and label locators where possible.

write login test changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

javascript
await page.goto('/login');
await page.getByLabel('Email').fill('qa@example.com');
await page.getByLabel('Password').fill('secret');
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page.getByText('Dashboard')).toBeVisible();

Q17. How do you choose Playwright locators?

role, label, placeholder, text, alt text, title, or test ID based on user intent comes first.

Use CSS or XPath only when user-facing locators are not practical.

choose locators changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q18. How do you avoid logging in for every test?

Create authenticated storage state once, then reuse it in relevant projects or setup.

Keep at least one test for the actual login flow.

use storage state changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q19. How do you use fixtures in a framework?

Use fixtures for reusable setup such as test data, authenticated page, API client, or cleanup.

Fixtures should make dependencies explicit.

set up fixtures changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q20. How do you mock a network response?

Use route handling to fulfill a request with controlled response data.

Mock only when the goal is UI behavior, not backend integration.

mock network changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q21. How do you wait correctly in Playwright?

Use locator assertions, action auto-waiting, or specific events instead of arbitrary time waits.

Wait for the state that matters.

wait correctly changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q22. How do you run tests across browsers?

Define projects for Chromium, Firefox, and WebKit, then choose which suites need all projects.

Not every low-risk test needs every browser.

run cross-browser changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q23. How do you debug a CI failure with traces?

Open the trace, inspect action timeline, DOM snapshot, console, network, screenshots, and error location.

Trace evidence is stronger than guessing.

debug with trace changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q24. Why use API setup in Playwright tests?

Create data through API, then use the UI only for the behavior under test.

This reduces test time and flake.

test API setup changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q25. How do you test file upload?

Use file chooser or setInputFiles, then assert upload success, validation, or preview.

Use small known test files.

handle file upload changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Watch a deeper explanation

Video: Playwright Testing Agents (Microsoft Developer, YouTube)

Q26. How do you test browser dialogs?

Register a dialog handler before the action that opens the dialog, then accept, dismiss, or assert its message.

Handlers must be set before the dialog appears.

handle dialogs changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q27. How do you test mobile behavior?

Use device projects or viewport settings and assert responsive behavior.

Viewport tests are not the same as native mobile app tests.

test mobile viewport changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q28. How do you organize Playwright tests?

Use projects, grep patterns, file naming, annotations, and tags for smoke, regression, and feature groups.

Organization should fit CI jobs.

use tags changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q29. What do you review in a Playwright pull request?

Check locator stability, assertion quality, data isolation, fixture clarity, runtime, and artifact configuration.

Test code should be reviewed like product code.

review test code changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q30. How do you reduce Playwright flake?

Use stable locators, isolated data, proper assertions, traces, controlled environment, and avoid shared state.

Retries should not hide root causes.

reduce flake changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Back to question list

Playwright Advanced Scenarios

Advanced15 questions

Advanced rounds test trade-offs, failure modes, and whether the decision can hold up under production pressure.

Q31. A locator matches two buttons. What does Playwright do?

Locator strictness can fail because the target is ambiguous.

Refine the locator by role name, scope, filter, or test ID.

strict mode failure changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q32. A test passes in Chromium but fails in WebKit. What do you check?

Check browser-specific behavior, CSS, timing, feature support, and whether the product supports that browser.

Cross-browser failures need product context.

works in Chromium only changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q33. Trace shows a button is covered by a spinner. What is the fix?

Wait for the spinner to disappear or assert the ready state before clicking.

The UI may also need better disabled states.

trace shows covered button changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q34. Tests fail in parallel when sharing one account. What do you change?

Use isolated accounts, separate data, or setup per worker.

Parallelism exposes state coupling.

shared storage changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q35. Generated code uses brittle selectors. What do you do?

Replace generated selectors with role, label, text, or test ID locators.

Codegen is a draft.

codegen XPath changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q36. A CI failure has no trace. What do you improve?

Configure trace on retry or on failure, plus screenshot, video, and HTML report artifacts.

Failure evidence is part of framework quality.

no trace in CI changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q37. API setup skips the UI path. Is that okay?

Yes if the test is not about that setup path, but keep separate UI coverage for critical setup behavior.

Use the right layer for the goal.

API setup hides bug changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q38. A test fails due to slow API response. What do you inspect?

Check whether the UI has proper loading state, timeout, backend issue, test data, or environment instability.

Slow network may reveal product risk.

flaky network changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q39. beforeEach creates lots of unused data. What is the issue?

Tests become slower and harder to reason about.

Setup should be close to what the test needs.

overbroad beforeEach changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q40. When are retries acceptable?

Retries are acceptable for known infrastructure noise, but every retry should be visible and tracked.

Retries are not a substitute for fixing flake.

retry policy changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q41. A page object hides every assertion. What is the risk?

Test intent becomes hard to read and failures are harder to diagnose.

Keep business assertions visible.

page object bloat changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q42. How do you test file download?

Wait for the download event, trigger the action, then assert filename or saved content where useful.

Avoid relying only on button click.

download test changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q43. How do you test a new tab in Playwright?

Wait for the page event on the context while triggering the action, then assert the new page.

Set the wait before the action.

new tab flow changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q44. A Playwright suite is too slow. What do you change?

Move setup to API, reduce duplicate UI paths, split smoke from regression, parallelize safely, and remove weak checks.

Speed must not reduce trust.

slow suite changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Q45. What makes a Playwright answer senior?

It explains locators, actionability, fixtures, contexts, traces, parallel isolation, and when to test below the UI.

Senior candidates design for trust and maintenance.

senior Playwright answer changes Playwright decisions by affecting the chosen method, the failure mode, or the validation step. Reliable evidence comes from a metric, test result, query output, log, or review note.

Back to question list

Playwright vs Cypress vs Selenium

Playwright, Cypress, and Selenium can all test web apps, but they make different trade-offs around browser support, language support, debugging, and framework design.

ToolStrong fitInterview strengthWatch out
PlaywrightModern cross-browser web automationAuto-waiting, contexts, traces, API setupRequires good fixture and project setup
CypressJavaScript front-end teamsRunner feedback and network stubbingCross-browser and multi-tab constraints matter
SeleniumEnterprise suites and wide language supportMature ecosystemMore manual framework choices
API testsFast backend checksStable setup and business rulesNo browser rendering proof

Playwright interview topic weight

Most Playwright screens are practical coding plus debugging questions.

Scale: Hyring editorial score for interview preparation, not an external benchmark.

Locators
90 weight
Auto-waiting
86 weight
Fixtures
80 weight
Reports
58 weight
  • Locators: role and label first
  • Auto-waiting: actionability
  • Fixtures: setup and isolation
  • Reports: supporting evidence

How to Prepare for a Playwright Interview

Prepare with one small TypeScript suite: login, a list page, one API setup, one mocked response, and one trace-based failure debug.

  • Practice getByRole, getByLabel, getByText, locator filters, expect assertions, APIRequestContext, fixtures, and storage state.
  • Understand browser, context, page, worker, project, and test fixture boundaries.
  • Use trace viewer, screenshots, videos, and HTML reports to explain failures.
  • Prepare a cross-browser answer: which tests to run across Chromium, Firefox, and WebKit and why.

Playwright test design flow

1Locate
role, label, text, test ID
2Isolate
context, storage, fixture, data
3Assert
user outcome and API side effect
4Debug
trace, screenshot, video, report

Stable Playwright tests usually stable locators and isolated state comes first.

What Strong Playwright Answers Prove

Strong Playwright answers show that you can write tests like maintainable code. The test should be readable, isolated, and debuggable.

TopicWeak answerStrong answer
LocatorsI use XPath.I role, label, text, or test ID that matches user intent comes first.
StateTests share one browser session.I use contexts, fixtures, and storage state intentionally.
DebuggingI rerun until it passes.I inspect trace, screenshot, video, console, and network.
Cross-browserRun everything everywhere.Run critical paths across engines and full regression where risk justifies it.

Test Yourself: Playwright Quiz

Ready to test your Playwright knowledge?

6 questions, about 4 minutes. Score 70% or higher to earn a shareable certificate.

6 questions Instant feedback Free certificate on 70%+

Frequently  Asked  Questions

What do Playwright interviews usually ask?

They ask about locators, auto-waiting, assertions, browser contexts, fixtures, projects, storage state, traces, parallelism, and CI failures. Complete coverage has one concrete example, one failure case, and one validation signal beyond the definition.

Is Playwright better than Cypress?

It depends. Playwright is strong for cross-browser automation and context isolation. Cypress is strong for JavaScript app debugging and runner feedback.

Do Playwright roles require TypeScript?

Many do. Playwright also supports other languages, but most web automation interviews use JavaScript or TypeScript. Complete coverage has one concrete example, one failure case, and one validation signal beyond the definition.

What Playwright project should I discuss?

Use a project where you built stable locators, used fixtures, ran cross-browser checks, debugged with traces, and fixed a flaky CI test.

What is the biggest Playwright interview mistake?

Using brittle selectors and arbitrary waits. Strong answers use locators, auto-waiting, explicit assertions, and trace evidence. Complete coverage has one concrete example, one failure case, and one validation signal beyond the definition.

Is there a Playwright quiz?

Yes. The quiz checks contexts, locators, trace viewer, auto-waiting, fixtures, and cross-browser strategy. Complete coverage has one concrete example, one failure case, and one validation signal beyond the definition.

Practice Playwright coding and explanation

Hyring's AI Coding Interviewer can score test code and reasoning together. Use this page to practice locators, fixtures, traces, and CI failure stories before a live automation screen.

Try AI coding interview prep

Sources

Adithyan RKWritten by Adithyan RK
Surya N
Fact-checked by Surya N
Published on: 10 Jun 2026Last updated: 10 Jul 2026
Share: