Interview question bank

Playwright Interview Questions and Answers

54 Playwright interview questions, each with a short answer you can say in the interview, a detailed explanation, a real-world example and an interview tip; 27 of them are marked as frequently asked. Freshers can start with the first section; experienced testers can jump to the harder questions.

Playwright interview questions for freshers

Beginner3 Years Frequently asked

1. How does Playwright auto-waiting differ from Selenium waits?

Answer: Playwright checks actionability (attached, visible, stable, enabled, receives events) before every action and retries until the timeout, so explicit waits are rarely needed.

Detailed explanation, example and interview tip

Every locator action re-queries the DOM at action time, which removes stale-element failures by design. Web-first assertions such as expect(locator).toBeVisible() also retry until the timeout, so you assert on state rather than on a snapshot. The pitfall is mixing in manual waitForTimeout calls: they slow the suite and reintroduce flakiness. When something genuinely needs waiting, wait for a condition — a response, a URL, or an assertion — not for a duration.

typescript
1// No explicit wait needed: click waits for actionability
2await page.getByRole('button', { name: 'Place order' }).click();
3
4// Web-first assertion retries until timeout
5await expect(page.getByTestId('order-confirmation')).toContainText('Thank you');
6
7// Wait on a condition, never a sleep
8await page.waitForResponse(r => r.url().includes('/api/orders') && r.status() === 201);

Real-world example

A Selenium suite with 40 explicit waits per page object shrank to zero waits after the Playwright port, and run time halved.

Interview tip

Name the five actionability checks — it proves you understand the mechanism, not just the marketing.

Beginner3 Years Frequently asked

2. Which locators do you prefer in Playwright and why?

Answer: Role-based and label-based locators first (getByRole, getByLabel), then getByTestId; raw CSS/XPath last because they couple tests to markup.

Detailed explanation, example and interview tip

getByRole queries the accessibility tree, so it survives styling and DOM restructuring and simultaneously checks that the control is reachable by assistive tech. getByLabel and getByPlaceholder read like the user's mental model for forms. When there is no accessible handle, a data-testid is an explicit contract with developers — better than a brittle nth-child chain. Chain and filter locators instead of writing long selectors, and use exact matching to avoid substring collisions.

typescript
1const row = page.getByRole('row', { name: /INV-1042/ });
2await row.getByRole('button', { name: 'Download' }).click();
3
4await page.getByLabel('Card number').fill('4111111111111111');
5await page.getByTestId('cart-total').filter({ hasText: '£' }).waitFor();
6
7// last resort
8await page.locator('css=.legacy-widget >> text=Continue').click();

Real-world example

A design-system upgrade changed every class name; role-based locators needed no edits while the CSS-based suite failed wholesale.

Interview tip

Mention the accessibility side-effect: role locators fail when a control is not accessible, which is a free a11y check.

Beginner3 Years Frequently asked

3. What is locator strategy, and why does it matter in Playwright?

Answer: locator strategy is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of locator strategy should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used locator strategy to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Beginner5 Years Frequently asked

4. What is parallel execution, and why does it matter in Playwright?

Answer: parallel execution is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of parallel execution should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used parallel execution to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Beginner7 Years Frequently asked

5. What is authentication state, and why does it matter in Playwright?

Answer: authentication state is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of authentication state should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used authentication state to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Beginner10+ Years Frequently asked

6. What is geolocation and permissions, and why does it matter in Playwright?

Answer: geolocation and permissions is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of geolocation and permissions should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used geolocation and permissions to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Beginner3 Years

7. How would you apply web-first assertions in a production Playwright project?

Answer: Apply web-first assertions through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that web-first assertions controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused web-first assertions check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing web-first assertions.

Beginner3 Years

8. What is browser contexts, and why does it matter in Playwright?

Answer: browser contexts is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of browser contexts should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used browser contexts to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Beginner3 Years

9. How would you apply projects in a production Playwright project?

Answer: Apply projects through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that projects controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused projects check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing projects.

Beginner5 Years

10. How would you apply trace viewer in a production Playwright project?

Answer: Apply trace viewer through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that trace viewer controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused trace viewer check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing trace viewer.

Beginner5 Years

11. What is screenshots and videos, and why does it matter in Playwright?

Answer: screenshots and videos is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of screenshots and videos should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used screenshots and videos to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Beginner5 Years

12. How would you apply APIRequestContext in a production Playwright project?

Answer: Apply APIRequestContext through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that APIRequestContext controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused APIRequestContext check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing APIRequestContext.

Beginner7 Years

13. How would you apply component testing in a production Playwright project?

Answer: Apply component testing through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that component testing controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused component testing check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing component testing.

Beginner7 Years

14. What is frames, and why does it matter in Playwright?

Answer: frames is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of frames should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used frames to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Beginner7 Years

15. How would you apply file uploads in a production Playwright project?

Answer: Apply file uploads through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that file uploads controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused file uploads check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing file uploads.

Beginner10+ Years

16. How would you apply visual comparisons in a production Playwright project?

Answer: Apply visual comparisons through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that visual comparisons controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused visual comparisons check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing visual comparisons.

Beginner10+ Years

17. What is clock mocking, and why does it matter in Playwright?

Answer: clock mocking is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of clock mocking should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used clock mocking to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Playwright interview questions for experienced testers

Intermediate5 Years Frequently asked

18. How do you reuse authentication instead of logging in per test?

Answer: Log in once in a setup project, save the session with storageState, and load that state in the config so each test starts signed in.

Detailed explanation, example and interview tip

Logging in through the UI in every test is the biggest avoidable cost in an e2e suite and the most common source of flakiness. A dependency project runs the login once, writes cookies plus localStorage to a JSON file, and the main projects load it via use.storageState. For role-based suites, save one file per role and select it per project or per test with test.use. Never commit the state file — treat it as a secret artifact and regenerate it per CI run.

typescript
1// auth.setup.ts
2import { test as setup, expect } from '@playwright/test';
3const file = 'playwright/.auth/admin.json';
4
5setup('authenticate as admin', async ({ page }) => {
6 await page.goto('/login');
7 await page.getByLabel('Email').fill(process.env.ADMIN_EMAIL!);
8 await page.getByLabel('Password').fill(process.env.ADMIN_PASSWORD!);
9 await page.getByRole('button', { name: 'Sign in' }).click();
10 await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
11 await page.context().storageState({ path: file });
12});
13
14// playwright.config.ts
15projects: [
16 { name: 'setup', testMatch: /auth\.setup\.ts/ },
17 { name: 'admin', dependencies: ['setup'], use: { storageState: 'playwright/.auth/admin.json' } },
18]

Real-world example

Removing per-test UI login from a 200-test suite cut 22 minutes off every CI run.

Interview tip

Add that the state file is gitignored and regenerated per run — interviewers probe for the security angle.

Intermediate5 Years Frequently asked

19. How do you mock or intercept network calls in Playwright?

Answer: page.route intercepts matching requests so you can fulfil them with fixtures, abort them, or modify the response — ideal for error states and third-party isolation.

Detailed explanation, example and interview tip

Interception lets you test UI branches that are hard to trigger for real: 500s, empty lists, slow responses, expired tokens. fulfil with a fixture for determinism, or fetch the real response and patch one field when you want to stay close to production behaviour. Register routes before navigation, otherwise the first call escapes the handler. Do not mock the very API you are supposed to be validating end to end — mock its neighbours.

typescript
1await page.route('**/api/recommendations', route =>
2 route.fulfill({ status: 500, contentType: 'application/json', body: '{"error":"boom"}' }));
3
4await page.route('**/api/cart', async route => {
5 const response = await route.fetch();
6 const json = await response.json();
7 json.total = 0; // patch one field, keep the rest real
8 await route.fulfill({ response, json });
9});
10
11await page.goto('/checkout');
12await expect(page.getByRole('alert')).toContainText('Recommendations unavailable');

Real-world example

An empty-state and a 500-state screen were untested for a year because staging always returned data; route mocking covered both in an afternoon.

Interview tip

State the rule 'mock dependencies, never the system under test' — it shows testing judgement.

Intermediate5 Years Frequently asked

20. How do you debug a test that only fails in CI?

Answer: Turn on trace, video and screenshot on first retry, download the artifact and open the trace viewer — it replays DOM snapshots, network, console and the action timeline.

Detailed explanation, example and interview tip

The trace viewer is the decisive advantage over log-based debugging: you see the exact DOM at the failing action plus the network calls that led there. Configure trace: 'on-first-retry' so passing runs stay fast. Common CI-only causes are a different viewport, missing fonts changing layout, slower machines exposing real races, and timezone/locale differences — all visible in the trace. Reproduce locally with the same container image before changing test code.

typescript
1// playwright.config.ts
2export default defineConfig({
3 retries: process.env.CI ? 2 : 0,
4 use: {
5 trace: 'on-first-retry',
6 video: 'retain-on-failure',
7 screenshot: 'only-on-failure',
8 viewport: { width: 1280, height: 800 },
9 timezoneId: 'Europe/London',
10 },
11 reporter: [['html', { open: 'never' }], ['github']],
12});

Real-world example

A checkout test failed only in CI; the trace showed a cookie banner that never appeared locally because of a different locale.

Interview tip

Say 'trace on first retry' specifically — it shows you balance debuggability against run time.

Intermediate3 Years Frequently asked

21. How would you apply locator strategy in a production Playwright project?

Answer: Apply locator strategy through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that locator strategy controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused locator strategy check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing locator strategy.

Intermediate3 Years Frequently asked

22. How would you apply browser contexts in a production Playwright project?

Answer: Apply browser contexts through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that browser contexts controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused browser contexts check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing browser contexts.

Intermediate3 Years Frequently asked

23. What is fixtures, and why does it matter in Playwright?

Answer: fixtures is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of fixtures should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used fixtures to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Intermediate5 Years Frequently asked

24. How would you apply parallel execution in a production Playwright project?

Answer: Apply parallel execution through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that parallel execution controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused parallel execution check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing parallel execution.

Intermediate5 Years Frequently asked

25. How would you apply screenshots and videos in a production Playwright project?

Answer: Apply screenshots and videos through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that screenshots and videos controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused screenshots and videos check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing screenshots and videos.

Intermediate5 Years Frequently asked

26. What is network interception, and why does it matter in Playwright?

Answer: network interception is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of network interception should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used network interception to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Intermediate7 Years Frequently asked

27. How would you apply authentication state in a production Playwright project?

Answer: Apply authentication state through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that authentication state controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused authentication state check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing authentication state.

Intermediate7 Years Frequently asked

28. How would you apply frames in a production Playwright project?

Answer: Apply frames through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that frames controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused frames check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing frames.

Intermediate7 Years Frequently asked

29. What is popups and downloads, and why does it matter in Playwright?

Answer: popups and downloads is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of popups and downloads should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used popups and downloads to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Intermediate10+ Years Frequently asked

30. How would you apply geolocation and permissions in a production Playwright project?

Answer: Apply geolocation and permissions through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that geolocation and permissions controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused geolocation and permissions check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing geolocation and permissions.

Intermediate10+ Years Frequently asked

31. How would you apply clock mocking in a production Playwright project?

Answer: Apply clock mocking through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that clock mocking controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused clock mocking check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing clock mocking.

Intermediate10+ Years Frequently asked

32. What is test sharding, and why does it matter in Playwright?

Answer: test sharding is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of test sharding should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used test sharding to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Intermediate3 Years

33. What is auto-waiting, and why does it matter in Playwright?

Answer: auto-waiting is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of auto-waiting should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used auto-waiting to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Intermediate5 Years

34. What is test retries, and why does it matter in Playwright?

Answer: test retries is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of test retries should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used test retries to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Intermediate7 Years

35. What is page object models, and why does it matter in Playwright?

Answer: page object models is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of page object models should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used page object models to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Intermediate10+ Years

36. What is mobile emulation, and why does it matter in Playwright?

Answer: mobile emulation is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of mobile emulation should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used mobile emulation to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced Playwright interview questions

Advanced10+ Years Frequently asked

37. Why would you migrate from Selenium to Playwright?

Answer: Auto-waiting, browser contexts for cheap isolation, built-in tracing/network interception, and much faster parallel execution — but Selenium wins on legacy browser support and ecosystem.

Detailed explanation, example and interview tip

Playwright's actionability checks remove most explicit waits, contexts give per-test isolated cookies/storage without new browser processes, and trace viewer makes CI failures debuggable. Migration should be incremental: new suites in Playwright, legacy Selenium retained until parity.

Real-world example

A 40-minute Selenium regression rewritten in Playwright with contexts ran in 9 minutes.

Interview tip

Never say Selenium is dead. Frame it as a cost/benefit and phased migration.

Advanced7 Years Frequently asked

38. How do Playwright fixtures, projects and auto-waiting change framework design?

Answer: Fixtures replace base classes for setup, projects replace testng.xml for browser/environment matrices, and web-first assertions with auto-waiting remove most explicit wait code.

Detailed explanation, example and interview tip

A fixture creates a per-test context, storage state and page object bundle, so there is no inheritance chain. Projects define browser, viewport and baseURL combinations plus dependencies (a setup project can log in once and save storageState). Locators are lazy and retried, and expect() polls, so waits are declarative. Trace viewer plus retries with trace: 'on-first-retry' gives you flake diagnosis for free.

typescript
1export const test = base.extend<{ login: LoginPage }>({
2 login: async ({ page }, use) => { await use(new LoginPage(page)); },
3});
4
5// playwright.config.ts
6projects: [
7 { name: 'setup', testMatch: /auth.setup.ts/ },
8 { name: 'chromium', dependencies: ['setup'], use: { storageState: '.auth/user.json' } },
9]

Real-world example

Moving login into a setup project cut a 240-test suite from 26 to 9 minutes.

Interview tip

Say 'fixtures over inheritance' — it signals you did not just port a Selenium design.

Advanced3 Years Frequently asked

39. What is web-first assertions, and why does it matter in Playwright?

Answer: web-first assertions is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of web-first assertions should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used web-first assertions to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced5 Years Frequently asked

40. What is trace viewer, and why does it matter in Playwright?

Answer: trace viewer is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of trace viewer should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used trace viewer to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced7 Years Frequently asked

41. What is component testing, and why does it matter in Playwright?

Answer: component testing is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of component testing should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used component testing to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced10+ Years Frequently asked

42. What is visual comparisons, and why does it matter in Playwright?

Answer: visual comparisons is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of visual comparisons should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used visual comparisons to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced7 Years

43. How does parallelism work in Playwright, and how do you scale it in CI?

Answer: Playwright runs files in parallel across worker processes, each with its own browser context; scale further by sharding the suite across CI machines and merging the reports.

Detailed explanation, example and interview tip

Workers are processes, so tests in different files are isolated by default; tests inside one file run serially unless you opt into test.describe.configure({ mode: 'parallel' }). Because every test gets a fresh browser context, cookies and storage never leak between tests. Sharding (--shard=1/4) splits the suite across machines; the blob reporter plus merge-reports gives one combined HTML report. The real constraint is test data — parallel workers must not fight over the same account or record.

bash
1# one machine, 6 worker processes
2npx playwright test --workers=6
3
4# four CI machines
5npx playwright test --shard=1/4 --reporter=blob
6npx playwright test --shard=2/4 --reporter=blob
7npx playwright merge-reports --reporter=html ./blob-report

Real-world example

Four-way sharding took a 40-minute regression suite to under 11 minutes on GitHub Actions.

Interview tip

Bring up per-worker test data (workerInfo.parallelIndex) — it is the bottleneck most candidates miss.

Advanced3 Years

44. How would you apply auto-waiting in a production Playwright project?

Answer: Apply auto-waiting through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that auto-waiting controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused auto-waiting check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing auto-waiting.

Advanced3 Years

45. How would you apply fixtures in a production Playwright project?

Answer: Apply fixtures through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that fixtures controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused fixtures check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing fixtures.

Advanced3 Years

46. What is projects, and why does it matter in Playwright?

Answer: projects is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of projects should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used projects to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced5 Years

47. How would you apply test retries in a production Playwright project?

Answer: Apply test retries through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that test retries controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused test retries check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing test retries.

Advanced5 Years

48. How would you apply network interception in a production Playwright project?

Answer: Apply network interception through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that network interception controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused network interception check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing network interception.

Advanced5 Years

49. What is APIRequestContext, and why does it matter in Playwright?

Answer: APIRequestContext is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of APIRequestContext should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used APIRequestContext to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced7 Years

50. How would you apply page object models in a production Playwright project?

Answer: Apply page object models through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that page object models controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused page object models check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing page object models.

Advanced7 Years

51. How would you apply popups and downloads in a production Playwright project?

Answer: Apply popups and downloads through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that popups and downloads controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused popups and downloads check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing popups and downloads.

Advanced7 Years

52. What is file uploads, and why does it matter in Playwright?

Answer: file uploads is a core Playwright concept used to make testing decisions more accurate, repeatable, and aligned with product risk.

Detailed explanation, example and interview tip

A strong explanation of file uploads should cover its purpose, the problem it solves, when it is appropriate, and where it can mislead a team. In Playwright, use it deliberately rather than as a checklist item: connect it to observable behavior, choose clear pass/fail evidence, and record assumptions so another engineer can reproduce the result.

Real-world example

During release planning, the team used file uploads to focus validation on the most important behavior and to communicate residual risk before deployment.

Interview tip

Answer in four parts: definition, suitable use case, limitation, and a concrete project example.

Advanced10+ Years

53. How would you apply mobile emulation in a production Playwright project?

Answer: Apply mobile emulation through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that mobile emulation controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused mobile emulation check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing mobile emulation.

Advanced10+ Years

54. How would you apply test sharding in a production Playwright project?

Answer: Apply test sharding through an explicit, repeatable design: define the expected behavior, automate the highest-risk path, capture useful diagnostics, and verify the result against a stable oracle.

Detailed explanation, example and interview tip

In a production Playwright project, start by identifying the risk that test sharding controls and the evidence needed to prove the behavior. Keep setup, action, verification, and cleanup separate; parameterize environment-specific values; and make failures explain the business impact. Run the smallest relevant check on each change, broader coverage in the pipeline, and review flaky or slow results rather than hiding them with retries.

Real-world example

A team introduced a focused test sharding check at the layer closest to the risk, attached diagnostics to failures, and used the result as a release signal instead of relying on manual confirmation.

Interview tip

Describe one trade-off, one failure mode, and one measurable outcome when discussing test sharding.

Interview questions by subject

Want to search across every subject? Open the full question bank.