Skip to content

Playwright Testing Interview Questions for IT services Companies

40 questions weighted to the interview style of it services companies — 13 easy, 26 medium, 1 hard.

How it services companies interview for Playwright Testing

IT services companies hire in large numbers, often in campus or bulk drives. Interviews usually start with an online aptitude and coding test, then one or two technical rounds on fundamentals and your projects, then HR. Clear basics and good communication matter more than rare, advanced topics.

This set focuses on JavaScript and TypeScript (8), Playwright Core (6), Debugging and Trace Viewer (5), Framework Design and CI/CD (4).

Technical interview HR round Managerial round Coding test Online assessment (aptitude + reasoning)
Solved — it services companiesStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
3 questions free Unlock the rest in seconds
01

How do test.slow() and longer timeouts help or hurt debugging?

Save to ▾
Show answer
test.slow() triples the timeout for a test that is genuinely long, such as a report export. It is honest and visible in code. But raising timeouts to make a flaky test pass hides the real cause, such as a missing wait or slow backend, and makes failures take longer. Investigate the trace first and change timeouts only with a reason.
02

What is the difference between ES modules and CommonJS?

Save to ▾
Show answer
ES modules use import and export and are the modern standard, loaded statically. CommonJS uses require and module.exports and is the older Node.js style. Playwright supports both, and TypeScript test projects usually write import syntax. Mixing them causes errors such as require is not defined, so set type in package.json and tsconfig consistently.
03

What does outputDir contain and why does it matter in parallel runs?

Save to ▾
Show answer
outputDir, test-results by default, holds per-test artifacts such as screenshots, videos and traces. Playwright creates a separate subfolder for each test and retry, so parallel workers do not overwrite each other's files. testInfo.outputPath gives you a safe path inside it for your own files. It is cleared at the start of every run, so do not store anything permanent there.
04

How do you send query parameters in an API request?

Save to ▾
Show answer
// GET /api/products?category=books&page=2 const res = await request.get('/api/products', { params: { category: 'books', page: 2 }, }); expect(res.ok()).toBeTruthy(); const body = await res.json(); expect(body.items.length).toBeGreaterThan(0);
05

What is the difference between test-scoped and worker-scoped fixtures?

Save to ▾
Show answer
A test-scoped fixture is created and torn down for every test, which keeps tests isolated. A worker-scoped fixture is set up once per worker process and shared by all tests that run in it, which suits expensive things like a started server or a seeded account. Declare it with { scope: 'worker' }. Worker fixtures cannot depend on test fixtures.
06

Images load lazily and are sometimes missing from full-page screenshots. How do you make them stable?

Save to ▾
Show answer
Scroll the content into view or remove loading=lazy for the test, then wait until every image has loaded, for example with expect.poll checking that all img elements report complete and a natural width above zero. Serving images from mocked routes removes network timing too. Only after that call toHaveScreenshot, which then waits for two identical frames.
07

What are closures?

Save to ▾
Show answer
A function that remembers variables from its outer scope even after that scope has finished. They are used for private state and factory helpers.
08

Tell me about a time you explained a failing test report to a non-technical stakeholder.

Save to ▾
Show answer
Situation: a product manager saw a red build and wanted to delay the release. Task: explain what actually failed. Action: I opened the HTML report, grouped failures into one real bug in the coupon flow and two flaky tests, and showed the screenshot of the real bug in plain words. Result: we shipped after the coupon fix, and the manager asked for that short summary on every release.
09

What can automated accessibility tools not catch?

Save to ▾
Show answer
Scanners like axe find rule-based problems such as missing labels, bad contrast or invalid ARIA, which is roughly a third to a half of real issues. They cannot judge whether alt text is meaningful, whether focus order makes sense, whether error messages are understandable, or whether a screen reader user can actually finish the task. So automated scans are combined with keyboard tests and periodic manual checks with screen readers.
10

How do you test a page in dark mode or with reduced motion?

Save to ▾
Show answer
Set colorScheme: 'dark' or reducedMotion: 'reduce' in the context options or test.use. You can also switch during a test with page.emulateMedia({ colorScheme: 'dark' }). Then assert the right styles or take a screenshot comparison. Reduced motion also helps stability, because many apps skip animations when that preference is set.
11

How do you handle multiple tabs or pop-ups?

Save to ▾
Show answer
Wait for the popup event with const [popup] = await Promise.all([page.waitForEvent('popup'), page.click('a')]), then interact with popup.
12

Which locators does Playwright recommend?

Save to ▾
Show answer
User-facing ones: getByRole, getByText, getByLabel, getByPlaceholder and getByTestId, which are more resilient than CSS or XPath.
13

What is the difference between the request fixture and request.newContext()?

Save to ▾
Show answer
The request fixture is a ready APIRequestContext that uses the config's baseURL and extraHTTPHeaders and is cleaned up automatically per test. playwright.request.newContext() creates your own context with custom settings, such as a different base URL or auth token, for example in a worker fixture. You must dispose a manually created context yourself.
14

How do you handle shadow DOM?

Save to ▾
Show answer
Playwright locators pierce open shadow roots by default, so getByRole and CSS locators work without special handling.
15

What is codegen?

Save to ▾
Show answer
npx playwright codegen records user actions and generates test code with suggested locators, handy for starting tests.
16

How do you read environment variables safely in a TypeScript test project?

Save to ▾
Show answer
Load a .env file with a package like dotenv in playwright.config, then read process.env.BASE_URL. Values are string | undefined, so validate them early and throw a clear error if a required one is missing. Keep .env out of git and commit an .env.example instead. In CI, set the same names as secret variables.
17

How do you shard tests across machines?

Save to ▾
Show answer
Use npx playwright test --shard=1/4 in each CI job and merge reports afterwards to reduce total run time.
18

How do you pass slots and listen to events in a Vue component test?

Save to ▾
Show answer
With the Vue package you can mount with an options object: mount(Button, { props: { label: 'Save' }, slots: { default: 'Click me' }, on: { click: handler } }). The on map receives emitted events, so you can push payloads into an array and assert on them. JSX syntax is also supported if the project is configured for it.
19

How do you check colour contrast in Playwright tests?

Save to ▾
Show answer
Playwright has no built-in contrast assertion, so you run axe-core through @axe-core/playwright, whose color-contrast rule checks text against WCAG ratios such as 4.5 to 1 for normal text. Scan pages in each theme, for example after emulating dark mode with colorScheme. Axe may report some elements as needing review, for example text over images, and those need a manual look.
20

Component and end-to-end tests run together and slow down every commit. How do you separate them?

Save to ▾
Show answer
Give them separate configs, such as playwright-ct.config.ts with its own testDir for component specs and playwright.config.ts for end-to-end tests, because component tests also need the bundler options and framework test import. In CI, run component tests on every commit as a fast job and end-to-end tests later or in parallel. Shared settings like reporters can live in a common module both configs import.
21

How do you organise tests with page object model in Playwright?

Save to ▾
Show answer
Create a class that takes a page, defines locators as properties and exposes action methods; instantiate it in a fixture for clean tests.
22

How do you override options like baseURL or viewport for one file?

Save to ▾
Show answer
Call test.use at the top of the file or inside a describe block, for example test.use({ viewport: { width: 375, height: 812 }, locale: 'hi-IN' }). The options apply only to tests in that scope. Options you can set this way include baseURL, storageState, colorScheme and extraHTTPHeaders. Global defaults stay in the use block of playwright.config.
23

How does this behave in arrow functions compared with regular functions?

Save to ▾
Show answer
A regular function gets this from how it is called, so passing a class method as a callback can lose this. An arrow function has no own this and uses the value from the surrounding code. In page objects, arrow functions in callbacks such as map keep access to this.page, which avoids undefined errors.
24

What are soft assertions?

Save to ▾
Show answer
await expect.soft(locator).toHaveText('...') records the failure but lets the test continue, so you see every mismatch in one run.
25

How do you capture browser console messages and page errors?

Save to ▾
Show answer
Listen with page.on('console', msg => ...) for console.log, warnings and errors, and page.on('pageerror', err => ...) for uncaught exceptions. Collect them in an array and attach them to the report on failure. Traces also show console output. Uncaught page errors often explain why a button did nothing or a page stayed blank.
26

How do you test a site protected by HTTP basic authentication?

Save to ▾
Show answer
Set httpCredentials with a username and password in the use block of the config, or pass it to browser.newContext. Playwright then answers the browser's authentication challenge automatically, so no pop-up appears. Read the values from environment variables rather than hard-coding them. You can also limit the credentials to a specific origin with the origin field.
27

How do you record a trace manually with the tracing API?

Save to ▾
Show answer
Call await context.tracing.start({ screenshots: true, snapshots: true }) before the steps, and await context.tracing.stop({ path: 'trace.zip' }) after them. This is useful in scripts that use the library without the test runner, or when you want a trace of only part of a flow. tracing.group can label sections of steps.
28

What does the waitUntil option of page.goto do?

Save to ▾
Show answer
waitUntil decides when goto considers navigation finished: 'load' waits for the load event and is the default, 'domcontentloaded' waits only for the HTML to parse, 'networkidle' waits for no network for 500 ms, and 'commit' returns when the response starts. Avoid networkidle, which is discouraged and flaky; use assertions on the content you need instead.
29

What does the mount fixture return?

Save to ▾
Show answer
mount renders the component into the test page and returns a locator pointing at the component root. You can call getByRole, click, and use web-first assertions on it like any locator. It also has helpers: update to re-render with new props or children, and unmount to remove it. Because it is a locator, the auto-waiting and retry behaviour of end-to-end tests applies here too.
30

What does the JUnit reporter produce and why do CI tools need it?

Save to ▾
Show answer
It writes an XML file in the JUnit format, with test suites, test cases, durations and failure messages. Most CI servers and test management tools read this format to show test counts, failures and history in their own dashboards. Set outputFile so the path is predictable, and publish that file as a test result in the pipeline.
31

How do you run tests on three browsers in parallel?

Save to ▾
Show answer
Define projects for chromium, firefox and webkit in playwright.config.ts, set workers, then run: npx playwright test
32

How do you work with iframes?

Save to ▾
Show answer
const frame = page.frameLocator('#payment-frame'); await frame.getByLabel('Card number').fill('4111 1111 1111 1111');
33

What is the difference between TypeScript and JavaScript?

Save to ▾
Show answer
TypeScript adds static types on top of JavaScript and compiles to it. Types catch errors early and give better autocomplete, which helps in larger test suites.
34

How do access modifiers help in page object classes?

Save to ▾
Show answer
private and protected hide internal locators and helper steps, so tests can only call meaningful public methods such as login or addToCart. This keeps tests readable and lets you change internals without breaking callers. readonly on the page field prevents it from being replaced. TypeScript enforces these at compile time only, not at runtime.
35

How do you check that a product list on the page is sorted by price?

Save to ▾
Show answer
const texts = await page.getByTestId('price').allTextContents(); const prices = texts.map(t => Number(t.replace(/[^0-9.]/g, ''))); const sorted = [...prices].sort((a, b) => a - b); expect(prices).toEqual(sorted); // wait for the list first with toHaveCount
36

How do you wait for a network response in Playwright?

Save to ▾
Show answer
Use page.waitForResponse(res => res.url().includes('/api/orders') && res.ok()) together with the action that triggers it.
37

What are web-first assertions?

Save to ▾
Show answer
Assertions like expect(locator).toBeVisible() that retry until they pass or time out, unlike one-off checks.
38

Promise.all vs Promise.allSettled vs Promise.race?

Save to ▾
Show answer
all waits for every promise and rejects on the first failure; allSettled waits for all and reports each outcome; race settles with the first one to finish.
39

What is UI mode and how is it different from --debug?

Save to ▾
Show answer
UI mode, opened with npx playwright test --ui, is a dashboard to run, filter and watch tests, with a trace-like timeline for each one and a watch mode that reruns on file changes. --debug opens the Inspector to step through a single run live. Use UI mode for daily development and --debug for stepping through a specific action.
40

How do you mock network traffic using a HAR file?

Save to ▾
Show answer
Record once with page.routeFromHAR('data/orders.har', { url: '**/api/**', update: true }) while running against a real server. Later runs replay the saved responses from the HAR instead of hitting the backend. You can edit the stored JSON to create edge cases. Re-record when the API changes, otherwise the replay drifts from reality.

IT services companies (33)

IT services

TCS

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Mumbai, Chennai, Pune +2

View questions
IT services

Infosys

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Mysuru, Pune +2

View questions
IT services

Wipro

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Hyderabad, Pune +2

View questions
IT services

Cognizant

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Chennai, Bengaluru, Pune +2

View questions
IT services

Capgemini

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Mumbai, Bengaluru, Pune +2

View questions
IT services

HCLTech

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Noida, Chennai, Bengaluru +2

View questions
IT services

Tech Mahindra

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Pune, Hyderabad, Bengaluru +2

View questions
IT services

IBM

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Pune, Hyderabad +2

View questions
IT services

Mphasis

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Pune, Chennai

View questions
IT services

LTIMindtree

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Mumbai, Pune, Bengaluru +2

View questions
IT services

Persistent Systems

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Pune, Nagpur, Bengaluru +2

View questions
IT services

Hexaware

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Navi Mumbai, Chennai, Pune +2

View questions
IT services

Coforge

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Noida, Greater Noida, Bengaluru +2

View questions
IT services

Zensar Technologies

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Pune, Hyderabad, Bengaluru

View questions
IT services

Birlasoft

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Pune, Noida, Bengaluru +1

View questions
IT services

Nagarro

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Jaipur

View questions
IT services

EPAM Systems

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Hyderabad, Bengaluru, Pune +2

View questions
IT services

GlobalLogic

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Noida, Bengaluru, Gurugram +2

View questions
IT services

Virtusa

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Hyderabad, Chennai, Bengaluru

View questions
IT services

UST

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Thiruvananthapuram, Kochi, Bengaluru +2

View questions
IT services

CGI

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Hyderabad, Chennai +1

View questions
IT services

NTT DATA

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Pune, Noida +2

View questions
IT services

Genpact

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Gurugram, Hyderabad, Bengaluru +2

View questions
IT services

L&T Technology Services

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Vadodara, Bengaluru, Chennai +2

View questions
IT services

Cyient

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Hyderabad, Bengaluru, Noida

View questions
IT services

Sonata Software

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Hyderabad

View questions
IT services

Mastek

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Mumbai, Pune

View questions
IT services

Happiest Minds Technologies

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Noida

View questions
IT services

KPIT Technologies

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Pune, Bengaluru

View questions
IT services

Tata Elxsi

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Thiruvananthapuram, Chennai +1

View questions
IT services

Quest Global

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Bengaluru, Thiruvananthapuram, Belagavi +1

View questions
IT services

Infogain

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Noida, Gurugram, Pune +1

View questions
IT services

YASH Technologies

Playwright Testing interview questions

  • 40 questions
  • 4 rounds

Indore, Pune, Hyderabad

View questions

Frequently asked questions

How are Playwright Testing interviews at it services companies different?

IT services companies hire in large numbers, often in campus or bulk drives. Interviews usually start with an online aptitude and coding test, then one or two technical rounds on fundamentals and your projects, then HR. Clear basics and good communication matter more than rare, advanced topics.

Which it services companies are covered?

This page links to 33 it services companies, including TCS, Infosys, Wipro, Cognizant, Capgemini, HCLTech, Tech Mahindra, IBM. Each has its own page with rounds and a separate practice set.

What rounds should I expect?

Common rounds at these companies include: Technical interview; HR round; Managerial round; Coding test; Online assessment (aptitude + reasoning). The exact process varies by company and role.