SoftwareTestPilot
30 Fresher Q&A

Top 30 Playwright Interview Questions for Freshers (1970) — Land Your First QA Job

The exact 30-question set for fresher Playwright interviews in 2026. Basics, locators, auto-wait, POM, network mocking, and CI/CD — each answer in the crisp definition → example → trade-off style interviewers love.

  • 3 min read
  • Difficulty: Beginner
  • 0–2 yrs
  • Updated June 1970
  • Avinash Kamble

1. Playwright Basics

Easy Very Common 1 min read

Q1.What is Playwright?

Playwright is an open-source test automation library built by Microsoft. It drives Chromium, Firefox, and WebKit via the DevTools Protocol, supports TypeScript, JavaScript, Python, Java, and .NET, and is the 2026 default for greenfield web testing projects.

Medium Very Common 1 min read

Q2.How is Playwright different from Selenium?

DimensionPlaywrightSelenium
Auto-waitNativeManual (explicit waits)
LanguagesTS, JS, Python, Java, .NETJava, C#, Python, Ruby, JS
Multi-tabYesYes
Browser installnpx playwright installManual driver management
SpeedFastestSlower

See our Selenium Q&A bank for the other side.

Medium Very Common 1 min read

Q3.How do you install Playwright?

npm init -y
npm install -D @playwright/test
npx playwright install --with-deps chromium firefox webkit
Medium Very Common 1 min read

Q4.What is `page` in Playwright?

page is a fixture provided by @playwright/test representing a single browser tab. Every test gets a fresh page by default — perfect isolation with no manual setup.

Confidence check

If you can confidently answer the Playwright Basics questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

2. Locators & Auto-Wait

Medium Very Common 1 min read

Q5.What is a `locator`?

A locator is a query for an element that re-evaluates every time it's used. Unlike Selenium's findElement, locators are lazy and stable.

await page.getByTestId('submit').click();
Medium Very Common 1 min read

Q6.Name five Playwright locator strategies.

  1. page.getByRole('button', { name: 'Submit' }) — best, accessibility-first.
  2. page.getByTestId('submit') — explicit test ID.
  3. page.getByLabel('Email') — accessible labels.
  4. page.getByText('Welcome') — text content.
  5. page.locator('.btn-primary') — CSS fallback.
Medium Very Common 1 min read

Q7.What is auto-wait?

Playwright waits for elements to be visible, stable, receiving events, and enabled before acting. You almost never need sleep or waitForElement — kills 80% of the flakiness you see in Selenium suites.

Medium Very Common 1 min read

Q8.How do you write assertions in Playwright?

import { expect } from '@playwright/test';

await expect(page).toHaveURL(/\/dashboard$/);
await expect(page.getByRole('heading')).toContainText('Welcome');
await expect(page.getByTestId('cart')).toHaveText('3');

All expect calls are auto-retrying — they keep polling until the assertion passes or times out.

Medium Very Common 1 min read

Q9.What is the Trace Viewer?

The Trace Viewer is a standalone HTML tool that shows DOM snapshots, network calls, console logs, and a timeline for every step of a test. The fastest way to debug a failure. Enable with trace: 'on-first-retry' in playwright.config.ts.

Confidence check

If you can confidently answer the Locators & Auto-Wait questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

3. Parallelism & Page Object Model

Medium Very Common 1 min read

Q10.How do you run tests in parallel?

@playwright/test runs tests in parallel by default. For CI, shard across machines with --shard=N/M and merge the JSON/HTML results.

Easy Very Common 1 min read

Q11.What is the Page Object Model?

POM is a design pattern where each page is a class with locators as properties and actions as methods. See our Playwright POM TypeScript guide for the full pattern.

Confidence check

If you can confidently answer the Parallelism & Page Object Model questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

4. Frames, Tabs & Network

Medium Common 1 min read

Q12.How do you handle iframes?

const frame = page.frameLocator('#payment-iframe');
await frame.getByRole('button', { name: 'Pay' }).click();
Medium Common 1 min read

Q13.How do you handle multiple tabs?

const [newPage] = await Promise.all([
  context.waitForEvent('page'),
  page.getByTestId('open-new-tab').click(),
]);
await newPage.getByRole('heading').waitFor();
Medium Common 1 min read

Q14.How do you intercept network calls?

await page.route('**/api/users', route => route.fulfill({
  status: 200,
  body: JSON.stringify([{ id: 1, name: 'Test User' }]),
}));
Easy Common 1 min read

Q15.What is the `request` fixture?

It lets you test APIs in the same runner as UI tests — handy for setup/teardown via API and for pure API tests. See our API Testing Q&A for deeper patterns.

Confidence check

If you can confidently answer the Frames, Tabs & Network questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

5. Screenshots, Videos & Time

Medium Common 1 min read

Q16.How do you take a screenshot on failure?

Add to playwright.config.ts:

use: { screenshot: 'only-on-failure' }
Medium Common 1 min read

Q17.How do you record a video?

use: { video: 'retain-on-failure' }
Medium Common 1 min read

Q18.How do you mock a date?

await page.clock.install({ time: new Date('2026-06-27') });
Easy Common 1 min read

Q19.What is `playwright.config.ts`?

The main config file where you set base URL, browsers, reporters, retries, timeouts, and parallelism. Treated as the single source of truth for the whole suite.

Confidence check

If you can confidently answer the Screenshots, Videos & Time questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

6. Running & Tagging Tests

Medium Common 1 min read

Q20.How do you run a single test?

npx playwright test login.spec.ts --headed
Medium Common 1 min read

Q21.What is `--grep`?

Filters tests by name or tag:

npx playwright test --grep "@smoke"
Medium Common 1 min read

Q22.How do you tag tests?

test('login flow', { tag: '@smoke' }, async ({ page }) => { /* ... */ });
Easy Occasional 1 min read

Q23.What is `test.beforeEach`?

A hook that runs before every test in the describe block. Use it for shared setup like login or navigating to a base URL.

Medium Occasional 1 min read

Q24.How do you handle authentication state?

test.use({ storageState: 'auth.json' });

Generate auth.json once in a global setup and reuse across tests to skip the login flow.

Confidence check

If you can confidently answer the Running & Tagging Tests questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

7. Real-World Scenarios

Medium Occasional 1 min read

Q25.What is `page.evaluate()`?

Runs JavaScript in the browser context:

const token = await page.evaluate(() => localStorage.getItem('auth_token'));
Medium Occasional 1 min read

Q26.How do you test file uploads?

await page.getByTestId('avatar').setInputFiles('avatar.png');
Medium Occasional 1 min read

Q27.How do you test downloads?

const download = await page.waitForEvent('download');
await download.saveAs('/tmp/report.pdf');
Medium Occasional 1 min read

Q28.How do you test drag-and-drop?

await page.getByTestId('item').dragTo(page.getByTestId('dropzone'));
Medium Occasional 1 min read

Q29.How do you test responsive design?

test.use({ viewport: { width: 375, height: 667 } });
Confidence check

If you can confidently answer the Real-World Scenarios questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

8. CI/CD Integration

Medium Occasional 1 min read

Q30.How do you integrate Playwright with CI/CD?

- run: npx playwright install --with-deps
- run: npx playwright test
- uses: actions/upload-artifact@v4
  if: ${{ !cancelled() }}
  with: { name: traces, path: test-results/ }

See our GitHub Actions CI guide for a deeper CI walkthrough.

Confidence check

If you can confidently answer the CI/CD Integration questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

Quick revision

  1. Q1: What is Playwright — Playwright is an open-source test automation library built by Microsoft.
  2. Q2: How is Playwright different from Selenium — Dimension Playwright Selenium Auto-wait Native Manual (explicit waits) Languages TS, JS, Python, Java, .NET Java, C#, Python, Ruby, JS Multi-tab Yes Yes Browser install npx playwri
  3. Q3: How do you install Playwright — npm init -y npm install -D @playwright/test npx playwright install --with-deps chromium firefox webkit
  4. Q4: What is `page` in Playwright — page is a fixture provided by @playwright/test representing a single browser tab.
  5. Q5: What is a `locator` — A locator is a query for an element that re-evaluates every time it's used.

Frequently asked questions

US: $75k–$105k. India: ₹5L–₹12L. UK: £30k–£45k. See our QA Salary Guide for the full breakdown.

Learn Playwright if you're targeting greenfield projects or JS shops. Learn Selenium if you need cross-language support or enterprise breadth.

No — Playwright works with plain JavaScript, Python, Java, and .NET. TypeScript is recommended for type safety but optional.

Build a small Todo app and test every interaction. The Sauce Labs demo app (saucedemo.com) is also a great open practice target.

Was this article helpful?

Key takeaways

  • Master the fundamentals before tackling advanced Playwright (Freshers) scenarios.
  • Always explain trade-offs — interviewers reward judgement, not memorisation.
  • Use real project examples; generic answers blend in.
  • Practice answers out loud — written prep doesn't transfer to live rounds.
  • Revise the 30-second cheat sheet the night before your interview.
  • Keep one strong scenario story ready for every section above.
Home