QAVeda Start Learning Free →
Interview Prep · Playwright Automation

Playwright Automation
Interview Questions

Real questions asked in actual QA interviews — 150 Q&As across Junior, Mid and Senior levels. Full answers, examples & real scenarios on QAVeda.

Practice Full Answers on QAVeda → Free · No credit card · 200+ lessons + quizzes included
150
Questions
3
Levels
Free
On QAVeda

Junior (0–2 years)

1
Fundamentals

What is Playwright, and what is it used for?

Playwright is an open-source end-to-end testing / browser-automation framework from Microsoft. It drives a *real* browser to act like a user — navigating, clicking, typing — and asserts the app behaves correctly.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
2
Fundamentals

How is Playwright different from Selenium?

Both automate browsers, but Playwright is more modern.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
3
Fundamentals

Which browsers does Playwright support?

Three engines that cover all the major browsers from one API.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
4
Setup

How do you set up a Playwright project?

One command scaffolds everything.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
5
Locators

What is a locator in Playwright?

A locator is a way to find element(s) on the page — but it's *lazy* and *auto-retrying*. It doesn't grab the element immediately; it re-finds it each time you act or assert, so it survives…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
6
Locators

What are the recommended ways to locate elements?

Prefer user-facing locators that mirror how a real person (and a screen reader) finds things — they're resilient to code changes.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
7
Core Concepts

What is auto-waiting in Playwright?

Before acting on an element, Playwright automatically waits for it to be ready — visible, enabled, stable, and able to receive events — up to a timeout. No manual sleep calls.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
8
Test Basics

How do you write a basic Playwright test?

Import test and expect, then write a test() block.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
9
Actions

What are the common actions in Playwright?

Every action auto-waits for the element to be actionable first.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
10
Actions

What is the difference between `fill` and `type` (pressSequentially)?

fill('text') — instantly sets the whole value in one go. Fast; preferred for most inputs.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
11
Assertions

What are web-first assertions in Playwright?

Assertions like expect(locator).toBeVisible() that automatically retry until the condition is true or a timeout is reached — ideal for async UIs where elements appear or update after a delay. No manual waits needed.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
12
Assertions

How do you assert an element's text? (toHaveText vs toContainText)

Both auto-retry.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
13
Assertions

How do you assert an element's visibility or state?

Web-first state assertions, all auto-retrying.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
14
Assertions

How do you assert the page URL or title?

Both accept a string or a regex and auto-retry — handy right after a navigation that takes a moment to settle.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
15
Actions

How do you navigate in Playwright?

Set a baseURL in the config so you can use relative paths like page.goto('/login').

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
16
Locators

How do you handle multiple matching elements?

A locator can match many elements. Refine or count them.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
17
Tools

How do you take a screenshot in Playwright?

Playwright can also capture screenshots automatically on failure (via config), and do visual comparison with toHaveScreenshot().

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
18
Execution

What is the difference between headless and headed mode?

Headless (the default) — the browser runs *invisibly*, with no UI window. Faster, and ideal for CI.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
19
Core Concepts

What is the difference between a browser, a browser context, and a page?

Contexts are what make tests independent *and* cheap to run in parallel.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
20
Core Concepts

What are fixtures in Playwright (like the `page` fixture)?

Fixtures are ready-made objects the test runner sets up and tears down for you. The most common is page — a fresh, isolated page per test. You destructure whatever you need.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
21
Configuration

What is playwright.config.ts?

The central configuration file for the whole suite. It controls.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
22
Execution

How do you run Playwright tests from the command line?

``bash

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
23
Tools

How do you debug a failing Playwright test?

Several built-in options.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
24
Tools

What is the Playwright trace viewer?

A post-run debugging tool that records a full timeline of a test — DOM snapshots before and after each action, screenshots, network calls, console logs, and the source line. Open it with.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
25
Tools

How do you view test results, and what reporters does Playwright have?

Playwright ships an HTML reporter by default.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
26
Core Concepts

What does Playwright check before performing an action like click?

Before clicking (and most actions), Playwright runs actionability checks — it waits until the element is.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
27
Core Concepts

What is `page.evaluate()` and when do you use it?

page.evaluate() lets you run a JavaScript function inside the browser and return the result back to your test. The function executes in the page's context — it can access the DOM, window, and any global…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
28
Test Basics

What are `test.only`, `test.skip`, and `test.fixme` used for?

These three modifiers let you control which tests run without deleting code.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
29
Tools

What is Playwright Codegen and how do you use it?

Codegen is Playwright's built-in test recorder — it opens a real browser, records every action you take, and generates the equivalent Playwright TypeScript (or other language) code in real time.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
30
Core Concepts

What does `waitForLoadState()` do, and what states can you wait for?

page.waitForLoadState() pauses the test until the page reaches a specific network/DOM loading milestone. It's used after navigation or an action that triggers a page load when you need the page to settle before acting on…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
31
Actions

How do you hover over an element, right-click, or double-click?

Playwright has dedicated methods for these three pointer actions — each triggers the appropriate browser events, including the CSS :hover state.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
32
Assertions

How do you assert that an element does NOT exist on the page?

Use the .not modifier on a web-first assertion. The two most useful variants are not.toBeVisible() and not.toBeAttached(), which cover slightly different scenarios.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
33
Core Concepts

How do you get the text content of an element in code?

To read an element's text as a string inside your test logic (not just assert it), use textContent() or innerText() on a locator.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
34
Configuration

How do you configure timeouts in Playwright?

Playwright has three independent timeout settings — global action timeout, test timeout, and assertion timeout — and you can set each at the config, suite, or individual test level.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
35
Actions

How do you handle keyboard shortcuts in Playwright?

Use page.keyboard.press() for single key combos and locator.press() when the focus must be on a specific element. Key names follow the standard DOM KeyboardEvent.key naming.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
36
Configuration

How do you emulate a mobile device in Playwright?

Playwright ships a catalogue of device profiles (viewport, user-agent, touch settings) you can apply either globally in config or per-test using test.use().

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
37
Assertions

How do you assert a list of elements against an expected array of text?

Pass an array to toHaveText() — Playwright checks each item in order and auto-retries until all match or the timeout expires.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
38
Test Basics

How do you use environment variables in Playwright tests?

Read them via process.env — the same way you would in any Node.js program. The standard workflow is to load a .env file using dotenv in the config, then access the variables in tests and…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
39
Tools

How do you attach extra information to a test report in Playwright?

Use test.info().attach() to embed screenshots, files, or plain text into the HTML report alongside the test result — so reviewers can see the evidence without digging through CI artifacts.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
40
Network

How do you block or abort specific network requests in Playwright?

Use page.route() with route.abort() to cancel matching requests — simulating blocked ads, failed CDN resources, or a specific API being unreachable.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
41
Actions

How do you handle drag and drop in Playwright?

Use locator.dragTo(targetLocator) for straightforward element-to-element drag. For complex custom drag interactions (canvas, sortable lists with specific coordinates), use the lower-level page.mouse API.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
42
Core Concepts

What is `expect.poll()` and when is it better than web-first assertions?

expect.poll() repeatedly calls a custom async function you provide and retries until the return value satisfies the assertion — or times out. It fills the gap when you need to wait for something Playwright's built-in…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
43
Assertions

How do you check that an input has a specific value after filling it?

Use toHaveValue() — the web-first assertion for checking what's currently in an <input>, <textarea>, or <select>.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
44
Actions

How do you get and set cookies in Playwright?

Use the browser context API — cookies belong to the context, not the page. You can read all cookies, set them before a test starts, or clear them between tests.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
45
Core Concepts

What is `page.waitForFunction()` and when do you use it?

page.waitForFunction() executes a JavaScript predicate inside the browser repeatedly until it returns a truthy value — or times out. It's for waiting on any JavaScript condition that the DOM API alone can't express.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
46
Test Basics

What are test annotations and how do you use `test.info()`?

test.info() gives you metadata about the currently running test — its title, retry count, project, and status — and lets you attach files, screenshots, or custom annotations to the HTML report.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
47
Test Basics

What is `test.slow()` and when do you use it?

test.slow() triples the timeout for the current test without you having to calculate and set a specific number. It's a quick way to mark a test as genuinely slower than average without over-engineering the timeout…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
48
Network

How do you simulate an offline state or slow network in Playwright?

Use page.context().setOffline() to cut the network entirely, or use the Chrome DevTools Protocol (CDP) to throttle bandwidth and latency — useful for testing loading states, error banners, and graceful degradation.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
49
Actions

How do you handle a date picker in Playwright?

The fastest approach is to type the date directly into the input field if the app allows it. For calendar-based pickers that block typing, navigate the calendar by clicking.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
50
Actions

How do you scroll to an element or scroll the page in Playwright?

Playwright usually scrolls automatically when you act on an element (click, fill). For cases where you explicitly need to scroll — to trigger lazy loading, to bring a fixed-bottom element into view, or to scroll…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →

Mid-Level (2–5 years)

1
Architecture

What is the Page Object Model, and how do you use it in Playwright?

POM is a pattern where each page (or component) gets a class holding its locators and actions, so tests read at a high level and selectors live in one place.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
2
Fixtures

How and why do you create custom fixtures in Playwright?

Extend the base test to provide reusable, pre-set-up objects — so every test gets them without repeating setup.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
3
Authentication

How do you avoid logging in through the UI in every test?

Log in once, save the authenticated browser state (cookies + localStorage) to a file, then reuse it so tests start already logged in — usually in a setup project or global setup.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
4
Network

How do you mock or intercept network requests?

page.route() intercepts matching requests so you can fulfil them with fake data, modify them, or block them — letting you test edge cases without a real backend.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
5
API

How do you make API calls in Playwright?

Use the request fixture — it sends HTTP requests directly, with no browser.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
6
Practical

How do you combine API and UI in a single test?

Use the API for fast setup, then test the UI behaviour — avoiding slow, flaky UI setup steps.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
7
Execution

How does parallel execution work in Playwright?

Playwright runs test files in parallel across workers (default = number of CPU cores), each an isolated process. Tests *within* a file run serially by default; add test.describe.configure({ mode: 'parallel' }) to parallelise inside a…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
8
Flakiness

How do you handle flaky tests in Playwright?

First *reduce* flakiness: use locators + web-first assertions, no hard sleeps, and isolated test data. Then configure retries so a transient failure re-runs, and trace: 'on-first-retry' to capture *why* it flaked.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
9
Test Design

How do you write data-driven (parametrized) tests?

Loop over a data array and generate one test per case.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
10
Test Design

What are the test hooks in Playwright?

Keep one-time, expensive work in beforeAll or global setup, and per-test work in beforeEach.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
11
Test Design

What are test.describe and test.step used for?

Both improve organisation and make debugging far easier.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
12
Practical

How do you interact with elements inside an iframe?

Use frameLocator to "enter" the frame, then locate inside it.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
13
Practical

How do you handle a new tab or popup window?

Wait for the popup event *while* triggering the action that opens it.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
14
Practical

How do you handle JavaScript dialogs (alert / confirm / prompt)?

Register a handler *before* triggering the dialog.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
15
Practical

How do you test file upload and download?

Upload — set the files on the input.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
16
Network

How do you wait for a specific network response?

Wait on the actual response, not an arbitrary timer.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
17
Assertions

What are soft assertions, and when do you use them?

expect.soft() records a failure but doesn't stop the test — so you can check several things and see *all* the failures in one run. A normal expect halts at the first failure.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
18
Locators

How do you narrow down locators (filtering and chaining)?

Chain locators to scope, and filter by text or a child element.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
19
Flakiness

Why shouldn't you use hard sleeps, and what do you use instead?

page.waitForTimeout(3000) is both flaky and slow — too short and it fails, too long and it wastes time on every run. Instead, wait for the *actual condition*.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
20
Assertions

How do you assert attributes, classes, or CSS?

These are web-first assertions too — they auto-retry until the condition holds or it times out.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
21
Configuration

How do you run the same tests across multiple browsers or devices?

Define projects in the config, each with a browser or emulated device.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
22
Configuration

What is global setup / teardown, and when do you use it?

A globalSetup script runs once before the entire suite (and globalTeardown after) — for one-time work like authenticating, seeding a database, or starting services. This is different from beforeAll, which runs once *per file*.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
23
Configuration

How do you run the same tests against different environments (dev/staging/prod)?

Parameterise the baseURL and secrets via environment variables, read in the config — never hard-code them.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
24
CI/CD

How do you run Playwright tests in CI?

Use the official GitHub Action or the Docker image (browsers preinstalled).

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
25
Locators

How do you handle the shadow DOM in Playwright?

Good news — Playwright's locators pierce open shadow DOM automatically. getByRole, getByText, and CSS locators work across shadow boundaries with no special API. (Closed shadow roots are intentionally inaccessible, just as they are to a…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
26
Execution

How do you tag and selectively run tests?

Tag tests in the title (or with annotations) and filter on the command line.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
27
Network

How do you record and replay API responses using HAR files?

Playwright can record a test run's network traffic into a HAR (HTTP Archive) file and replay it in later runs — so your tests run against stable, pre-recorded responses instead of a live backend.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
28
Network

How do you modify a request before it reaches the server?

Use page.route() with route.continue() — which lets you intercept a request, change headers, body, or URL, and forward the modified version to the server.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
29
API

What is `APIRequestContext` and how do you use it outside a browser?

APIRequestContext is Playwright's HTTP client for making API requests with no browser involved — suitable for pure REST/GraphQL API tests or for setup/teardown that needs to talk to a backend without loading a page.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
30
Fixtures

How do you set up fixtures for multiple user roles (admin, user, guest)?

Create a separate auth state file per role during a setup project, then define fixtures that load the right state — so each test gets exactly the session it needs in one line.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
31
Practical

How do you handle OAuth or SSO login flows in Playwright tests?

The key is to authenticate via the API or a direct token exchange instead of driving the SSO UI — which is slow, brittle, and often rate-limited by the identity provider.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
32
Test Design

What does `test.describe.configure()` do and when do you use it?

test.describe.configure() changes the execution mode or timeout for all tests within a describe block — the two main options are mode: 'parallel' (run tests in the block concurrently) and mode: 'serial' (run them strictly one…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
33
Practical

How do you emulate geolocation in Playwright?

Set geolocation on the browser context via context.setGeolocation() or in the config, and grant the geolocation permission so the browser API returns the spoofed coordinates instead of asking the user.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
34
Network

How do you intercept and mock GraphQL requests?

GraphQL sends all queries via POST to a single endpoint (usually /graphql). Intercept that route, inspect the request body to identify the operation, and return a custom mock response.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
35
Test Design

How do you reliably clean up test data after each test?

Put teardown in test.afterEach() or in a fixture's cleanup phase, and use the API for fast deletion — not the UI. Wrap teardown in try/catch so a failed cleanup doesn't mask the actual test failure.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
36
Practical

How do you use `test.info()` inside a helper or page object?

Import test from @playwright/test in your helper and call test.info() — it returns the current test's metadata regardless of where in the call stack you are, as long as you're inside an active test.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
37
Architecture

How do you organise fixtures into separate files for a large project?

Create a custom test export that extends the base with all your fixtures, then import that custom test everywhere instead of the default one. Split fixtures across logical files and merge them with mergeTests().

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
38
Practical

How do you handle lazy-loading and infinite scroll in Playwright tests?

For lazy-loaded elements, scroll to bring them into the viewport and wait for them to appear. For infinite scroll, repeatedly scroll to the bottom and wait for new content, using an item count assertion to…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
39
Assertions

How do you assert ARIA attributes and accessibility roles?

Use toHaveAttribute() for specific ARIA attribute values, toHaveRole() for the computed accessible role, and the role-based locators (getByRole) as a built-in accessibility check — if the locator finds the element, the role is correct.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
40
Practical

How do you handle clipboard interactions (copy and paste) in Playwright?

Grant the clipboard permission, use page.evaluate() to read from or write to the clipboard via the browser's Clipboard API, and combine with keyboard shortcuts to test copy-paste flows.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
41
Practical

How do you handle multi-tab workflows in Playwright?

Each tab is a Page object in a shared BrowserContext. You can open new tabs programmatically, switch between them, and share cookies/storage across them — because they're in the same context.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
42
Practical

How do you capture and assert on browser console errors during a test?

Attach a page.on('console') listener before the action that might produce console errors, collect messages by type, and assert at the end of the test that no errors were logged.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
43
Practical

How do you test a third-party payment iframe (like Stripe or PayPal)?

Use page.frameLocator() to enter the payment iframe and interact with the fields inside it. For Stripe specifically, use the test card numbers from their docs and target the individual card field iframes.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
44
Architecture

How do you build reusable Page Object components for widgets that appear on many pages?

Build a component class for the shared widget — just like a page object, but scoped to a locator within the page rather than the whole page. Pass a Locator as the constructor argument so…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
45
Test Design

How do you implement a custom retry wrapper for flaky operations?

Write a helper that wraps an async operation in a loop, catches errors, and retries up to a maximum attempt count with a delay between tries — separate from Playwright's built-in test-level retry which reruns…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
46
CI/CD

How do you use Playwright in a TypeScript monorepo with project references?

Configure a dedicated tsconfig.json for the Playwright project, use TypeScript project references to depend on shared packages, and set rootDir and paths so the test runner resolves your internal packages correctly.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
47
Practical

How do you test file downloads and verify the file contents?

Use page.waitForEvent('download') to capture the download event, save the file, then read and assert its contents using Node.js fs module.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
48
Practical

How do you test WebSockets in Playwright?

Use page.on('websocket') to listen for WebSocket connections, then hook into ws.on('framereceived') and ws.on('framesent') to observe and assert on the messages exchanged.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
49
Network

How do you test Server-Sent Events (SSE) in Playwright?

SSE is just a regular HTTP response with Content-Type: text/event-stream. You can intercept it with page.route() and mock the stream, or observe it via page.on('response') to assert on real SSE traffic.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
50
Test Design

How do you handle a component that renders inside an `<iframe>` across multiple tests?

Build a component page object scoped to the frameLocator, then reuse it in every test that needs to interact with that iframe — so the iframe's internal structure is defined in one place.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →

Senior (5+ years)

1
Architecture

How do you architect a scalable Playwright framework?

Layer it for clarity and reuse.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
2
Flakiness

What is your strategy to eliminate flakiness across a large suite?

Root-cause it, don't just retry.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
3
Performance

How do you speed up a large suite by sharding?

Split the tests across multiple machines/CI jobs and merge the results.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
4
Architecture

POM vs fixtures vs helpers — how do you structure a big suite?

Use each for its strength.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
5
Authentication

How do you handle authentication across many tests and roles?

Authenticate once per role in setup, save each role's storageState to its own file, then load the right one per test or project.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
6
Test Data

What is your test data strategy for end-to-end tests?

The goal is independence — any test can run alone, in any order, in parallel.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
7
Visual Testing

How do you do visual regression testing in Playwright?

toHaveScreenshot() captures a baseline image and compares it on later runs.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
8
Accessibility

How do you test accessibility with Playwright?

Integrate @axe-core/playwright to scan pages for WCAG violations inside your tests and assert there are none critical.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
9
Component Testing

What is Playwright component testing, and when do you use it?

Playwright can mount and test individual UI components (React/Vue/Svelte) in a *real* browser, in isolation — faster and more focused than full E2E, and more realistic than jsdom-based unit tests.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
10
CI/CD

How do you integrate and parallelise Playwright in CI/CD?

Keep PR runs quick so they don't block the team; schedule the deep, slow runs.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
11
Reporting

How do you track flaky tests and report results across a big suite?

Merge the blob reports from all shards into one HTML report.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
12
Strategy

How do you decide what to cover with E2E UI tests vs API tests?

Follow the testing pyramid.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
13
Network

When do you mock the network vs hit the real backend?

Balance: mock for breadth and speed, real for truth.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
14
Security

How do you manage secrets (logins, API keys) in Playwright tests?

Never hard-code or commit them. Use environment variables / CI secret stores, inject at runtime, use dedicated test accounts with minimal scope, and scrub secrets from traces, reports, and logs. Keep separate credentials per environment.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
15
Strategy

How much cross-browser and device testing should you actually run?

Let user analytics decide, not "all of them." Run the full suite on the primary browser; run the critical paths on the others and on key devices. Running everything everywhere triples the cost for little…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
16
Performance

An E2E suite takes 40 minutes. How do you speed it up?

Parallelise (workers) and shard across machines.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
17
Debugging

A test passes locally but fails only in CI. How do you debug it?

Capture artifacts: trace: 'on-first-retry', screenshots, and video — then open the trace from the failed CI run. Common causes: slower CI machines (timing), different viewport/headless rendering, missing data or env config, parallelism collisions, and locale/time-zone…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
18
Locators

How do you keep locators maintainable in a large suite?

Prefer role/label/text locators — resilient to markup churn.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
19
Flakiness

When do retries help, and when do they hide real bugs?

Retries help with genuinely transient issues (network blips, animation timing) and keep CI green. They hide real, intermittent *product* bugs and mask flakiness you ought to fix.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
20
Configuration

What belongs in global setup vs per-test setup?

Heavy one-time work in global setup keeps the suite fast; per-test setup preserves isolation.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
21
Migration

How would you migrate a Selenium or Cypress suite to Playwright?

Incrementally — never big-bang.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
22
Fixtures

What are worker-scoped fixtures, and when do you use them?

By default fixtures are per-test. A worker-scoped fixture is created once per worker process and shared across that worker's tests — for expensive setup you don't want repeated (a logged-in context, a DB connection, a…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
23
Monitoring

Can Playwright be used for production monitoring?

Yes — run a few critical-path Playwright scripts on a schedule against production (synthetic monitoring), alerting if login or checkout breaks. It's shift-right testing: it catches real-world issues (CDN, third parties, infra) that staging can't…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
24
Practical

How do you test multi-user or role-based interactions (e.g., chat, approvals)?

Use multiple browser contexts in one test — each its own isolated session/user. Act as user A in one and user B in the other, asserting the interaction.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
25
Strategy

Which Playwright tests should block a merge vs run nightly?

Gating *everything* on every PR slows the team and invites flaky-blocked merges.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
26
Authentication

How do you handle session expiry, tokens, and 2FA in end-to-end auth?

Refresh storageState before it expires (re-auth in setup).

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
27
Performance

How do you measure and assert on page performance (Core Web Vitals, load timing) in Playwright?

Use the browser's Performance API via page.evaluate() to read navigation and paint timing metrics after page load, and assert they fall within acceptable thresholds.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
28
Strategy

How do you handle test flakiness caused by third-party integrations?

Isolate third-party dependencies with mocks for most tests, run a smaller set of contract-verified "real" tests in a scheduled pipeline, and use circuit-breaker patterns to prevent a flaky third-party from blocking PRs.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
29
Strategy

How do you test a multi-tenant SaaS application — data isolation, tenant context, and role-based access?

Create isolated test tenants in a dedicated test environment, authenticate as each tenant separately using storageState per tenant, and assert that cross-tenant data access is blocked — not just missing from the UI.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
30
Reporting

How do you build a custom Playwright reporter that posts results to Slack or Jira?

Implement the Reporter interface from @playwright/test/reporter, hook into onEnd() to collect results, and call the Slack/Jira API to post a summary or create tickets for failures.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
31
Strategy

What is your strategy for testing internationalisation (i18n) and localisation (l10n)?

Create a Playwright project per locale, set the browser's locale and timezoneId, and assert locale-specific text, date formats, currency symbols, and right-to-left layouts.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
32
Strategy

How do you implement a risk-based test prioritisation strategy?

Map every test to a risk score based on business impact, change frequency, and historical failure rate. Run the highest-risk tests on every PR; schedule the lower-risk ones less frequently.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
33
Strategy

How do you onboard new engineers to a large Playwright codebase?

Make the framework self-documenting, create a structured learning path, pair on real tests early, and automate the feedback loop so mistakes are caught immediately by tooling rather than code review.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
34
Test Data

How do you manage database state for integration tests alongside Playwright E2E tests?

Use a dedicated test database, seed it with known baseline data in global setup, and have each test create its own records via the API — cleaning up in afterEach. For heavier isolation, use database…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
35
Strategy

How do you test rate limiting and throttling behaviour?

Test from two directions: mock the rate-limit response (429) to verify the frontend handles it gracefully, and run a small set of real rapid-fire requests in a controlled environment to verify the backend actually enforces…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
36
Strategy

How do you test Progressive Web App (PWA) features — offline mode, service workers, install prompt?

Use Playwright's service worker intercept API to verify registration, context.setOffline() for offline mode, and page.on('console') to detect install prompt events fired by the browser engine.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
37
Strategy

How do you measure and improve test reliability KPIs over time?

Track flakiness rate, mean time to detect (MTTD), and suite pass rate as weekly metrics. Store results per test in a database or observability platform, build a flakiness leaderboard, and treat chronic offenders as engineering…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
38
Architecture

How do you share Playwright page objects and utilities across multiple repos or apps in a monorepo?

Publish page objects and fixtures as an internal npm package in your monorepo, imported by each app's test suite. Type-safe shared utilities ensure a UI change in the shared component is caught as a compile…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
39
Strategy

How do you test email flows (confirmation emails, OTP, password reset links) in E2E tests?

Use a real test email inbox via a testing-specific email service (Mailosaur, MailHog, Mailtrap), poll for the email via their API, extract the link or code, and continue the test with it — never hard-code…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
40
Architecture

How do you evaluate and adopt a new testing tool or framework for your team?

Run a structured proof of concept on a real, representative test scenario; evaluate against defined criteria; present a clear trade-off analysis; and adopt incrementally rather than big-bang replacing the existing suite.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
41
Architecture

How do you design a fixture dependency graph to manage complex test setup cleanly?

Define fixtures as composable, scoped units with explicit dependencies declared through Playwright's fixture extension mechanism — so the framework wires up the dependency graph automatically, and teardown is guaranteed in reverse order.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
42
Strategy

How do you integrate visual regression testing into CI without blocking every PR?

Run visual tests on a schedule (nightly) or only on PRs that touch UI files, use a separate approval pipeline for baseline updates, and tolerate a small pixel difference threshold to avoid noise from anti-aliasing.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
43
Practical

How do you test cross-origin scenarios — where a test spans multiple domains?

Use Playwright's multi-context or multi-page support, configure the browser to allow cross-origin access where needed, and use separate contexts with their own storageState for each domain.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
44
CI/CD

How do you test blue/green deployments and canary releases with Playwright?

Use environment variables to point tests at the blue or green environment, run smoke tests against both before and after traffic shift, and build a rollback trigger if the post-release smoke test fails.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
45
Security

How do you incorporate security testing into a Playwright test suite?

Add targeted security assertions to existing E2E tests — checking auth boundaries, IDOR vulnerabilities, security headers, and input handling — rather than replacing a dedicated security scanner.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
🔓
You're reading previews.
Full answers with walked-through examples, real-world QA scenarios and rules of thumb are free on QAVeda.
Open QAVeda — it's free →
46
Test Data

How do you manage parallel test data isolation at scale — unique IDs, namespacing, and cleanup?

Use a namespacing strategy that embeds the test's unique identifier into every piece of data it creates, track created resources in a fixture for cleanup, and implement a global cleanup sweep for orphaned data from…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
47
Strategy

How do you decide when to write a new E2E test vs pushing coverage down to an API test or unit test?

Apply the testing trophy: write the cheapest test that gives you confidence. An E2E test is justified only when it tests the full browser-to-backend integration of a user-facing flow that API tests can't cover alone.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
48
Practical

How do you test file uploads that involve processing (virus scanning, image resizing, format conversion)?

Separate the upload trigger (UI interaction) from the processing result (eventual consistency assertion). Use expect.poll() or waitForResponse() to wait for the backend processing to complete, then assert the final state.

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
49
Strategy

How do you maintain a Playwright test suite through rapid, frequent UI changes?

Design tests against behaviour and intent (what the user accomplishes), not implementation (which CSS class changes). Centralise locators in page objects, adopt data-testid as a contract with developers, and treat locator maintenance as a first-class…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
50
Strategy

How do you build and maintain a Playwright testing strategy for a product team that ships daily?

Design the test suite as a layered pipeline — fast feedback on every commit, deeper coverage on a schedule — and treat test quality as a first-class engineering concern with explicit ownership, metrics, and regular…

↳ Includes walked-through example, real-world QA scenario & rule of thumb

Get the full answer on QAVeda →
Don't just read. Practice.
QAVeda has full answers with walked-through examples, 200+ structured lessons, Mastery Trial quizzes and certificates — all gamified with XP, badges and ranks.
Start for Free on QAVeda →
Free · No credit card required