Quiz September 11, 2026 12 min read

Playwright MCQ Quiz: Test Your Automation Knowledge (2026)

15 multiple-choice questions across three difficulty tiers — Beginner, Intermediate, and Advanced. Take this free Playwright quiz to assess your skills, find your gaps, and know exactly what to study next.

How this quiz works: Answer 5 questions per tier (Beginner, Intermediate, Advanced). After each tier, check the score interpretation to see where you stand. Scroll past each question to see the correct answer with a detailed explanation. Track your score as you go — your total out of 15 reveals your overall Playwright readiness.

Whether you are preparing for a Playwright interview, studying for a certification exam, or simply want to benchmark your automation knowledge, this Playwright MCQ quiz gives you an honest self-assessment in under 12 minutes. The questions cover the topics that matter most in 2026 — from basic locator strategies to advanced AI-powered testing with MCP.

Grab a notepad, write down your answers (A/B/C/D) for each question, then check the explanations below each one. Ready? Let’s go.


Beginner Tier (Questions 1–5)

These questions test your understanding of Playwright fundamentals — installation, locators, assertions, and the auto-waiting mechanism.

Question 1
Which command installs Playwright and scaffolds a new project with a config file, example test, and browser binaries?
  1. npm install playwright
  2. npx playwright install
  3. npm init playwright@latest
  4. npx create-playwright
Answer: Cnpm init playwright@latest is the recommended way to scaffold a new Playwright project. It creates a playwright.config.ts, example test files, and installs browser binaries. Option A installs the library but does not scaffold. Option B only downloads browser binaries for an existing installation. Option D is not a valid Playwright command.
Question 2
Which locator method is the most resilient to UI redesigns because it targets an element’s semantic role and accessible name?
  1. page.locator('css=button.submit')
  2. page.getByRole('button', { name: 'Submit' })
  3. page.getByTestId('submit-btn')
  4. page.locator('xpath=//button[@type="submit"]')
Answer: BgetByRole() queries the accessibility tree rather than the DOM structure. Because it targets the element's ARIA role and accessible name, it survives CSS class renames, DOM restructuring, and layout changes. CSS selectors (A) and XPath (D) are brittle. getByTestId (C) is more stable than CSS/XPath but relies on a custom data attribute rather than semantics.
Question 3
What does Playwright’s auto-waiting mechanism check before performing a click() action?
  1. Only that the element exists in the DOM
  2. That the element is visible and not animating
  3. That the element is attached, visible, stable, enabled, and not obscured
  4. That the page has fully loaded (load event fired)
Answer: C — Before performing a click, Playwright waits for the element to meet all actionability checks: attached to the DOM, visible, stable (not animating), enabled (not disabled), and receives events (not obscured by another element). This is what makes explicit sleep() or waitForSelector() calls unnecessary in Playwright.
Question 4
Which assertion verifies that a specific element contains exact text content?
  1. await expect(locator).toBeVisible()
  2. await expect(locator).toHaveText('Welcome')
  3. await expect(locator).toHaveCount(1)
  4. await expect(locator).toContainText('Welcome')
Answer: BtoHaveText() asserts the element’s full text content matches the expected string. Option A checks visibility, not text. Option C checks the number of matched elements. Option D (toContainText) checks for a substring, not an exact match. Both B and D are text assertions, but the question asks for exact text content.
Question 5
What is the default timeout for Playwright actions like click() and fill()?
  1. 5 seconds
  2. 10 seconds
  3. 30 seconds
  4. 60 seconds
Answer: C — Playwright’s default action timeout is 30 seconds (30,000 ms). If an element does not become actionable within this period, the action fails with a timeout error. You can customize this globally in playwright.config.ts via actionTimeout or per-action with { timeout: 5000 }.

Score Check — Beginner Tier: Got 4–5 correct? You have solid Playwright fundamentals. Got 2–3? Review the basics — start with our Playwright beginner guide. Got 0–1? Don’t worry — read our installation tutorial and locators guide before continuing.


Intermediate Tier (Questions 6–10)

These questions go deeper into fixtures, hooks, API testing, configuration, and parallel execution — the topics that separate a beginner from a working professional.

Question 6
What is the purpose of Playwright test fixtures?
  1. To record and replay user interactions
  2. To provide isolated, reusable setup and teardown for each test
  3. To generate test reports in HTML format
  4. To parallelize tests across multiple machines
Answer: B — Fixtures in Playwright provide a way to establish the environment for each test with isolated, reusable setup and teardown logic. Built-in fixtures like page, context, and browser give each test a fresh browser context. You can also define custom fixtures (e.g., authenticated page, database seed) that are automatically created and cleaned up per test.
Question 7
Which hook runs once before all tests in a file, making it ideal for one-time setup like authentication?
  1. test.beforeEach()
  2. test.beforeAll()
  3. test.afterEach()
  4. test.describe.configure()
Answer: Btest.beforeAll() runs once before all tests in the file (or describe block). It shares a single worker, making it ideal for expensive one-time setup like authenticating and saving storage state. test.beforeEach() (A) runs before every test. test.afterEach() (C) runs after every test. test.describe.configure() (D) configures test mode (e.g., serial) but is not a hook.
Question 8
How do you make an API request within a Playwright test without opening a browser page?
  1. page.goto('/api/users')
  2. request.get('/api/users') using the request fixture
  3. fetch('/api/users') in Node.js
  4. page.evaluate(() => fetch('/api/users'))
Answer: B — Playwright provides a built-in request fixture (APIRequestContext) for making HTTP requests without a browser. It shares cookies and auth with the browser context, supports GET, POST, PUT, DELETE, and returns typed responses. Option A opens a page navigation. Option C uses raw Node fetch without Playwright’s context. Option D runs fetch inside the browser, which requires an open page.
Question 9
In playwright.config.ts, which property controls how many tests run simultaneously?
  1. retries
  2. workers
  3. timeout
  4. fullyParallel
Answer: B — The workers property sets the maximum number of parallel worker processes. Each worker runs tests in its own isolated environment. retries (A) controls how many times a failed test is retried. timeout (C) sets the per-test time limit. fullyParallel (D) determines whether tests within a single file can run in parallel, but the actual concurrency is still controlled by workers.
Question 10
Which assertion checks that a list on the page contains exactly 5 items?
  1. await expect(page.getByRole('listitem')).toHaveCount(5)
  2. await expect(page.getByRole('listitem')).toBeVisible()
  3. await expect(page.getByRole('listitem')).toHaveText('5')
  4. await expect(page.getByRole('list')).toHaveCount(5)
Answer: AtoHaveCount(5) asserts that the locator resolves to exactly 5 elements. You target listitem (the individual <li> elements), not list (the <ul>/<ol> container). Option B checks visibility, not count. Option C checks text content. Option D would count the number of <ul>/<ol> elements, not list items.

Score Check — Intermediate Tier: Got 4–5 correct? You understand Playwright’s framework-level features well. Got 2–3? Review fixtures and hooks and API testing. Got 0–1? Focus on the structured course path before tackling the Advanced tier.


Advanced Tier (Questions 11–15)

These questions cover trace viewer debugging, network interception, advanced configuration, and the AI/MCP topics that define Playwright expertise in 2026.

Question 11
What does the Playwright Trace Viewer record for each test action?
  1. Only console logs and error messages
  2. DOM snapshots, screenshots, network requests, and console logs for each action
  3. Only a video recording of the browser
  4. Source code coverage metrics
Answer: B — The Trace Viewer captures a complete timeline for each action: DOM snapshots (before and after), screenshots, network requests and responses, console logs, and source code location. You enable it with trace: 'on-first-retry' in the config and open traces with npx playwright show-trace trace.zip. It is the most powerful debugging tool in Playwright.
Question 12
Which method intercepts and mocks a network request in Playwright?
  1. page.on('request', handler)
  2. page.route(url, handler)
  3. page.waitForResponse(url)
  4. page.setExtraHTTPHeaders(headers)
Answer: Bpage.route() intercepts requests matching a URL pattern and lets you fulfill() with mock data, abort() the request, or continue() with modifications. Option A is an event listener that observes requests but cannot modify them. Option C waits for a response but does not intercept. Option D sets headers for outgoing requests but does not mock responses.
Question 13
How do you configure Playwright to run tests in serial order within a single describe block instead of in parallel?
  1. test.describe.configure({ mode: 'serial' })
  2. test.describe.configure({ mode: 'sequential' })
  3. Set workers: 1 in the config
  4. Use test.slow() on each test
Answer: Atest.describe.configure({ mode: 'serial' }) forces tests in that describe block to run one after another. If one test fails, all subsequent tests in the block are skipped. Option B uses an invalid mode name. Option C limits global concurrency to 1 worker but does not enforce order within a describe block. Option D triples the timeout but does not change execution order.
Question 14
What is the Model Context Protocol (MCP) and how does it relate to Playwright in 2026?
  1. A browser protocol that replaces Chrome DevTools Protocol for Playwright
  2. A Playwright plugin for mobile app testing on real devices
  3. An open standard that lets AI models like Claude interact with tools such as Playwright to generate and execute tests
  4. A Microsoft certification framework for Playwright professionals
Answer: C — The Model Context Protocol (MCP) is an open standard that enables AI models (like Claude) to interact with external tools and data sources. A Playwright MCP Server exposes browser automation capabilities to AI agents, allowing them to navigate pages, interact with elements, take screenshots, and generate tests using the accessibility tree rather than CSS selectors.
Question 15
When using AI agents with Playwright via MCP, why do they prefer the accessibility tree over raw CSS selectors?
  1. CSS selectors are not supported by the MCP protocol
  2. The accessibility tree provides semantic meaning (roles, names, states) that is more stable and meaningful than DOM position
  3. The accessibility tree is smaller and faster to parse
  4. CSS selectors cannot target hidden elements
Answer: B — The accessibility tree represents the page in terms of semantic roles, names, and states (e.g., “button named Submit”) rather than HTML structure. This gives AI agents a stable, human-like understanding of the page that survives DOM changes. CSS selectors are technically supported (A is wrong), the tree is not always smaller (C), and CSS can target hidden elements with specific selectors (D).

Score Check — Advanced Tier: Got 4–5 correct? You have strong advanced Playwright knowledge including 2026’s AI/MCP topics. Got 2–3? Brush up on MCP Server tutorials and debugging guides. Got 0–1? The advanced topics need focused study — the practice tests course below covers all of them with detailed explanations.


Your Overall Score Guide

Add up your correct answers across all three tiers (out of 15 total) and find your level below:

13–15 correct — Expert: You have excellent Playwright knowledge across all levels. You are ready for senior SDET interviews and certification exams. Consider the practice tests course to validate your knowledge under timed conditions.

9–12 correct — Proficient: You have solid fundamentals and good intermediate knowledge, but some gaps in advanced topics. Focus your study on the tiers where you scored lowest. The practice tests course will help you close those specific gaps with targeted questions and explanations.

5–8 correct — Developing: You understand the basics but need structured practice on intermediate and advanced topics. Work through the Playwright learning roadmap and take the full practice tests course to build comprehensive knowledge.

0–4 correct — Getting Started: Start with the Playwright beginner guide, practice with Codegen, and come back to retake this quiz in a week. The practice tests course includes beginner-level questions with detailed explanations to build your foundation.

Practice Tests Course

Found Your Knowledge Gaps? Fill Them Fast

This quiz covers just 15 questions. The full practice tests course has 190+ exam-style Q&A with detailed explanations for every answer — perfect for targeted gap-filling before interviews or certification exams.

  • 190+ questions across all difficulty levels
  • Detailed explanations reveal WHY each answer is correct
  • Covers the newest 2026 topics: MCP AI Agents, CI/CD pipelines
  • 5.0 rating — trusted by 131+ learners
Get 190+ Practice Questions →

Udemy 30-day money-back guarantee. No risk.


Frequently Asked Questions

Is this Playwright MCQ quiz free?

Yes, completely free. All 15 questions with answers and explanations are on this page with no signup required. For a more comprehensive assessment, the Playwright Automation Practice Tests course on Udemy offers 190+ exam-style questions with detailed explanations.

How can I test my Playwright knowledge online?

Take this free 15-question MCQ quiz organized into Beginner, Intermediate, and Advanced tiers. Work through each tier, check your answers, and use the score interpretation guide to identify your skill level and knowledge gaps. For deeper assessment, take a structured practice test with 190+ questions covering all Playwright topics.

What topics does a Playwright skill assessment cover?

A comprehensive Playwright skill assessment covers: installation and setup, locator strategies (getByRole, getByText, getByTestId), assertions (toBeVisible, toHaveText, toHaveCount), auto-waiting, fixtures, hooks, API testing, parallel execution, configuration, trace viewer, CI/CD, and AI/MCP topics.

How many questions should a Playwright quiz have?

A quick self-assessment needs 10–20 questions to identify gaps across difficulty levels. This free quiz has 15. For thorough interview or certification preparation, aim for 100+ questions covering all Playwright domains. The full practice tests course offers 190+ questions.

Can this quiz help me prepare for Playwright interviews?

Yes. This quiz tests the same concepts that appear in real Playwright SDET interviews: locators, assertions, auto-waiting, fixtures, API testing, config, debugging, and AI/MCP topics. Your score across the three tiers reveals exactly which areas need more study. Pair it with our 50+ interview questions guide for comprehensive preparation.

Asim Noaman
Asim Noaman
Senior QA Automation Engineer & AI Testing Specialist — LinkedIn