Playwright interview questions for freshers (0–1 year) focus on fundamentals: what Playwright is and how it works, locators, auto-waiting and web-first assertions, and enough TypeScript to read and write a test. These 55 questions have short answers you can say out loud and expand with your own example.

Playwright interview questions by experience: Freshers · 2 years · 3 years · 5 years

55 questions with concise answers. Focus: testing fundamentals, Playwright basics, locators, assertions, TS basics.

Testing Fundamentals

What is software testing?

Verifying software behaves as expected and finding defects before users do.

Manual vs automation testing?

Manual = human executes; automation = scripts execute repeatedly, faster and more reliably for regression.

Why automate tests?

Speed, repeatability, early regression detection, coverage, and freeing humans for exploratory testing.

What should you NOT automate?

One-off checks, rapidly changing UI, exploratory/usability testing, and cases where automation cost exceeds value.

Functional vs non-functional testing?

Functional = what the system does; non-functional = how it performs (speed, security, usability).

Smoke vs regression testing?

Smoke = quick check that core features work; regression = broad check that changes didn’t break existing features.

What is a test case?

A defined set of steps, inputs, and expected results to verify a feature.

What is a test suite?

A collection of related test cases run together.

Positive vs negative testing?

Positive = valid input works; negative = invalid input is handled/rejected correctly.

What is a defect/bug?

A deviation between actual and expected behavior.

What is the STLC?

Software Testing Life Cycle: requirement analysis → planning → design → environment setup → execution → closure.

What is a test plan?

A document defining scope, approach, resources, and schedule of testing.

What is E2E testing?

Validating a complete user journey across the whole system.

What is unit vs integration vs E2E?

Unit = single function; integration = modules together; E2E = full user flow.

What is the test pyramid?

Many unit tests, fewer integration, fewest E2E — balancing speed and confidence.

Advertisement

Playwright Basics

What is Playwright?

A modern open-source framework by Microsoft for reliable web automation across Chromium, Firefox, and WebKit.

Which languages does Playwright support?

TypeScript/JavaScript, Python, Java, and .NET.

Why Playwright over Selenium?

Auto-waiting, web-first assertions, trace viewer, cross-browser via one API, faster and less flaky.

What browsers does it support?

Chromium, Firefox, WebKit (Safari engine).

What is auto-waiting?

Playwright waits for elements to be actionable before acting — reducing flakiness without manual waits.

How do you install Playwright?

npm init playwright@latest (scaffolds config + browsers) or npm i -D @playwright/test + npx playwright install.

How do you run tests?

npx playwright test; add --headed, --project, -g, --debug as needed.

What is headless mode?

Running the browser without a visible UI — the CI default; faster.

What is page in Playwright?

An object representing a single browser tab you interact with.

What is a BrowserContext?

An isolated browser session (own cookies/storage) — like a fresh incognito profile.

How do you navigate to a URL?

await page.goto('https://...') (or /path with a baseURL).

What file holds configuration?

playwright.config.ts.

What is the HTML report?

A built-in visual report of results; open with npx playwright show-report.

Locators

What is a locator?

A lazy, auto-retrying reference to element(s) on the page.

Preferred locator order?

getByRole > getByLabel > getByText > getByPlaceholder > getByTestId > CSS > XPath.

Why prefer getByRole?

It mirrors how users/assistive tech find elements and resists refactors.

How to locate a button by text?

page.getByRole('button', { name: 'Submit' }).

What is getByTestId?

Locates by a data-testid attribute — a stable hook for volatile UI.

CSS vs XPath — which first?

CSS; XPath only when necessary. Prefer semantic locators over both.

What is strict mode?

If a locator matches multiple elements, actions error — forcing unique locators.

How to handle multiple matches intentionally?

Narrow with .filter()/getByRole({name}), or .first()/.nth() when appropriate.

How to click an element?

await locator.click().

How to type into a field?

await locator.fill('text').

Assertions

What is an assertion?

A check that a condition holds; failure fails the test.

What are web-first assertions?

expect(locator).toBeVisible() etc. that auto-retry until true or timeout.

Why prefer web-first assertions?

They remove timing races — no manual waits needed.

How to assert text?

await expect(locator).toHaveText('...') or toContainText('...').

How to assert visibility?

await expect(locator).toBeVisible().

How to assert URL/title?

await expect(page).toHaveURL(/.../) / toHaveTitle(/.../).

How to assert a value?

await expect(locator).toHaveValue('...').

What is a soft assertion?

expect.soft(...) continues the test after failure, reporting all issues at the end.

toBeVisible vs isVisible()?

toBeVisible auto-retries (assertion); isVisible() returns an instant boolean (no wait).

TypeScript Basics

Why TypeScript for automation?

Type safety catches errors early and improves IDE autocomplete/refactoring.

let vs const?

const for values that don’t reassign; let for those that do.

What is async/await?

Syntax to write asynchronous code sequentially; Playwright APIs return Promises you await.

What is an interface?

A type describing an object’s shape (e.g., a User with typed fields).

What is an array method you’d use in tests?

map/filter — e.g., convert cell texts to numbers, filter results.

Practical/Behavioral

How do you debug a failing test?

Use --debug/--ui, read the trace viewer, and check the DOM snapshot at the failing step.

What makes a good automated test?

Independent, deterministic, readable, fast, with clear assertions and stable locators.

How do you keep tests non-flaky as a beginner?

Web-first assertions, semantic locators, no waitForTimeout, unique data.

Tip: For each answer, be ready to show a one-line code example — interviewers love “explain and demonstrate.”

FAQs

Is Playwright good for freshers?

Yes. It is modern, well documented and auto-waits, so beginners write stable tests quickly; the core concepts transfer to Selenium and other tools.

Should freshers learn Playwright with TypeScript or Java?

TypeScript gets the most out of the Playwright Test runner; Java is a good choice if the company already uses Java with Selenium. Learn the concepts once and they apply to both.