Playwright
Senior Lead Quality Engineer
100 Questions — Easy • Hard • Scenario-Based
Interview Questions & Answers
Prepared as a Playwright equivalent of the attached Cypress interview pack.[file:1]
Table of Contents
1. Easy Questions (Q1 – Q35)
35 fundamental Playwright concepts
2. Hard Questions (Q36 – Q65)
30 advanced and internals questions
3. Scenario-Based Questions (Q66 – Q100)
35 real-world test scenarios
4. Tips & Best Practices
Senior-level guidance for production test suites
5. Common Mistakes to Avoid
Top 10 anti-patterns that hurt test quality
6. Must-Know Tools & Integrations
Useful Playwright ecosystem tools
7. Playwright Cheat Sheet
Quick-reference command and assertion guide
8. Interview Prep Tracker
Checklist to track revision progress
Easy Questions
Q1. What is Playwright and how is it different from Selenium?
Playwright is a modern end-to-end testing and browser automation framework from
Microsoft that supports Chromium, Firefox, and WebKit with one API. Unlike Selenium’s
WebDriver-based model, Playwright talks to browsers through native browser protocols and
provides fast auto-waiting, built-in tracing, network control, and multi-browser support.
[file:1]
Q2. What languages does Playwright support?
Playwright supports JavaScript, TypeScript, Python, Java, and .NET. The most commonly
discussed interview setup uses Playwright Test with JavaScript or TypeScript.
Q3. How do you install Playwright?
Install the Playwright test package and browser binaries:
npm init playwright@latest
Or with an existing Node project:
npm install -D @playwright/test
npx playwright install
Q4. What is Playwright Test?
Playwright Test is Playwright’s built-in test runner. It provides fixtures, parallel execution,
retries, reporters, projects, hooks, traces, screenshots, videos, and web server integration in
one framework.
Q5. What is [Link]() used for?
[Link]() navigates the page to a given URL and waits for the load condition you specify
or the default navigation lifecycle.
await [Link]('[Link] [Link] ')
await [Link]('/dashboard')
Q6. How do you select elements in Playwright?
Use locators such as [Link](), [Link](), [Link](),
[Link](), and [Link]().
await [Link]('.btn-subm it').click()
await [Link]('button', { nam e: 'Login' }).click()
await [Link]('login-btn').click()
Q7. What is the recommended way to select elements for testing?
Prefer user-facing locators like role, label, placeholder, and text when they are stable. For
complex apps, data-testid is the most common explicit test selector because it stays
decoupled from styling and layout.[file:1]
Q8. How do you type into an input field in Playwright?
Use fill() to replace existing text or type() when you want keystroke-style input.
await [Link]('Em ail').fill('user@exam [Link] ')
await [Link]('input[type="password"]').fill('m ypassword')
Q9. How do you click a button in Playwright?
Use .click() on a locator.
await [Link]('button', { nam e: 'Subm it' }).click()
await [Link]('Login').click()
Q10. How do assertions work in Playwright?
Playwright uses the expect API from Playwright Test. Assertions such as toBeVisible ,
toHaveText, and toHaveURL auto-retry until they pass or time out.
await expect([Link]('heading')).toBeVisible()
await expect(page).toHaveURL(/dashboard/)
Q11. What is the difference between locator and Elem entHandle ?
A locator is lazy, auto-waiting, and re-resolves the element each time you use it. An
Elem entHandle points to a specific DOM node snapshot and is more brittle, so interviewers
usually expect you to prefer locators.
Q12. How do you intercept network requests in Playwright?
Use [Link]() or [Link]() to intercept, mock, or modify requests.
await [Link]('**/api/users', async route => {
await [Link]({ json: [{ id: 1, nam e: 'Alice' }] })
})
Q13. What is test data mocking in Playwright?
It means replacing real backend responses with controlled stubbed responses using
[Link](), inline JSON, or fixture files so tests stay deterministic.
Q14. How do you handle dialogs in Playwright?
Use the dialog event.
[Link]('dialog', async dialog => {
await [Link]()
})
Q15. What is [Link]() in Playwright?
It is a hook that runs before each test, usually for navigation, login setup, or fixture
preparation.
Q16. How do you run Playwright in headless mode?
Playwright runs headless by default in CI-style runs. You typically use:
npx playwright test
For headed mode:
npx playwright test --headed
Q17. What file structure does Playwright commonly use?
A common structure is tests/ for specs, [Link] for configuration, fixtures/
for helpers, pages/ for page objects, and utils/ for shared helpers.
Q18. What is a fixture in Playwright?
A fixture is reusable setup and dependency injection for tests, such as authenticated pages,
seeded users, or helper APIs.
Q19. How do you clear an input field in Playwright?
Use fill('') or use clear() where available through locator actions in newer APIs; fill('')
remains the simplest interview-safe answer.
Q20. How do you take screenshots and videos in Playwright?
Use [Link]() for manual screenshots, and configure screenshots, videos, and
traces in [Link] or per test.
Q21. What is waitForTim eout() and when should you use it?
waitForTim eout() is a fixed sleep and is generally discouraged. Prefer waiting on locators,
responses, URLs, or assertions instead, just like the Cypress guide discourages fixed waits.
[file:1]
Q22. What is [Link]?
It is the main configuration file for Playwright Test, where you define base URL, retries,
projects, reporters, trace settings, timeout, and browser options.
Q23. How do you create reusable helper methods in Playwright?
Use page objects, custom fixtures, or utility modules.
export class LoginPage {
constructor(private page: Page) {}
async login(em ail: string, password: string) {
await [Link]('Em ail').fill(em ail)
await [Link]('Password').fill(password)
await [Link]('button', { nam e: 'Login' }).click()
}
}
Q24. What does getByRole() do?
It finds elements by accessible role and name, which makes tests more resilient and
accessibility-friendly.
Q25. What is [Link]() used for?
It reloads the current page.
await [Link]()
Q26. What is APIRequestContext used for?
It is used for direct API testing, setup, teardown, and authenticated backend calls without
going through the UI.
Q27. What is the default timeout in Playwright?
Playwright has separate test, action, navigation, and assertion timeouts. In interviews, the
important point is that timeouts are configurable globally and per action or assertion.
Q28. How do you check whether an element exists or is hidden?
Use assertions like toBeVisible , toBeHidden, toHaveCount, or check a locator count.
await expect([Link]('m odal')).toBeVisible()
await expect([Link]('spinner')).toBeHidden()
Q29. What is the difference between hidden and detached?
Hidden means the element is still in the DOM but not visible. Detached means it is removed
from the DOM entirely.
Q30. How do you check a checkbox in Playwright?
Use check() and uncheck().
await [Link]('term s').check()
await expect([Link]('term s')).toBeChecked()
Q31. How do you select from a dropdown in Playwright?
Use selectOption().
await [Link]('select[nam e="country"]').selectOption('IN')
Q32. What is [Link]() used for?
It runs JavaScript inside the browser page context.
Q33. How do you hover over an element in Playwright?
Use hover().
await [Link]('m enu-item ').hover()
Q34. What is [Link]() or inputValue() used for?
They let you read current DOM text or input values when assertions are not enough.
Q35. What is browserContext used for?
A browser context is an isolated browser session with its own cookies, storage, permissions,
and pages.
Hard Questions
Q36. How does Playwright handle asynchronous code?
Playwright uses standard async JavaScript with async/await. Unlike Cypress’s command
queue model, Playwright commands are regular promises, so sequencing is explicit in your
code.[file:1]
Q37. Why does Playwright work well with async/await?
Because Playwright APIs return promises. Each action or assertion can be awaited directly,
which makes control flow easier to reason about for engineers coming from standard [Link]
code.
Q38. What is the difference between page , context, and browser ?
browser is the top-level browser process, context is an isolated session, and page is a tab inside
that context.
Q39. How do you handle multi-tab or popup flows in Playwright?
Use [Link]('page') or [Link]('popup') and then interact with the
new page.
const popupProm ise = [Link]('popup')
await [Link]('Open').click()
const popup = await popupProm ise
await [Link]()
Q40. What is storageState and when would you use it?
storageState saves cookies and local storage to a file so authenticated state can be reused
across tests and projects.
Q41. How do you test file uploads in Playwright?
Use setInputFiles().
await [Link]('input[type="file"]').setInputFiles('tests/fixtures/sam [Link]')
Q42. How do you test file downloads in Playwright?
Use the download event and save the file.
const downloadProm ise = [Link]('download')
await [Link]('download-btn').click()
const download = await downloadProm ise
await [Link]('downloads/[Link]')
Q43. How do you set and read cookies in Playwright?
Use [Link]() and [Link]().
Q44. How do you speed up authentication in Playwright?
Use setup projects, storageState , API login, or shared authenticated fixtures instead of
logging in via the UI in every test, similar to the Cypress recommendation to avoid repeated
UI login.[file:1]
Q45. How do you perform API-only login in Playwright?
Send an auth request through request or APIRequestContext, capture the auth state, and
reuse it in the browser context.
Q46. How does Playwright auto-waiting work?
Playwright waits for elements to become actionable before clicking, typing, or checking.
Assertions also retry until success or timeout.
Q47. How do [Link]() and [Link]() differ?
route() intercepts or mocks requests before they complete. waitForResponse() observes a
real response and lets you synchronize on it.
Q48. How do you test localStorage and sessionStorage?
Use [Link]() or initialize values with [Link]() before the page loads.
Q49. How do you handle dynamic elements that appear after a delay?
Use locator assertions with explicit expectations and rely on Playwright’s auto-wait instead
of hard sleeps.
Q50. How do you run Playwright tests in parallel?
Playwright Test supports parallel execution by default at worker level. You can control it
with workers, fullyParallel, projects, and CI sharding.
Q51. How do you create custom fixtures in Playwright?
Extend the base test object.
im port { test as base } from '@playwright/test'
export const test = [Link]<{ loggedInPage: Page }>({
loggedInPage: async ({ browser }, use) => {
const context = await [Link]({ storageState: '[Link]' })
const page = await [Link]()
await use(page)
await [Link]()
}
})
Q52. What is the Playwright project feature?
Projects let you run the same suite across different browsers, devices, locales, permissions, or
configurations from one config file.
Q53. How do you handle browser permissions in Playwright?
Grant them in the browser context.
const context = await [Link]({ perm issions: ['geolocation'] })
Q54. How do you test drag and drop in Playwright?
Use dragTo() for supported cases or lower-level mouse actions for custom widgets.
Q55. How does Playwright handle shadow DOM?
Playwright locators can pierce open shadow DOM in many common cases automatically,
which simplifies testing web components.
Q56. What is the difference between locator() and fram eLocator()?
locator() targets elements in the current document. fram eLocator() is used to target
elements inside iframes.
Q57. How do you debug Playwright tests?
Use headed mode, --debug , [Link](), the Inspector, traces, screenshots, videos, and
HTML reports.
Q58. How do you handle cross-browser testing in Playwright?
Define multiple projects in config for Chromium, Firefox, and WebKit, then run the same tests
against each.
Q59. How do you configure retries for flaky tests?
Set retries globally in config or override at project or suite level.
Q60. How do you modify a request before it is sent?
Use [Link]() with modified headers, method, or post data.
await [Link]('**/api/orders', async route => {
const request = [Link]()
const data = [Link]([Link]() || '{}')
[Link] = 'TEST10'
await [Link]({ postData: [Link](data) })
})
Q61. What is the difference between [Link](), [Link](), and
[Link]()?
fulfill() returns a mocked response, continue() lets the request proceed optionally with
modifications, and abort() blocks it.
Q62. What is test isolation in Playwright?
Each test usually gets a fresh browser context through fixtures, which isolates cookies, local
storage, and page state unless you deliberately reuse state.
Q63. How do you test WebSocket-heavy apps in Playwright?
You usually validate UI effects, use backend controls, and inspect app behavior rather than
frame-level interception. For advanced cases, combine app-side hooks, mocked services, or
CDP-based debugging.
Q64. How do you use Playwright Component Testing?
Playwright also supports component testing in supported setups, where a component is
mounted in isolation and tested with Playwright’s locator and assertion model.
Q65. How do you measure performance-related behavior in Playwright?
Use [Link]() with the Performance API, collect timings, or integrate Lighthouse-style
audits separately from functional assertions.
Scenario-Based Questions
Q66. Scenario: A login page redirects to /dashboard on success. Write a complete
Playwright test.
im port { test, expect } from '@playwright/test'
test('logs in and redirects to dashboard', async ({ page }) => {
await [Link]('/login')
await [Link]('Em ail').fill('user@exam [Link] ')
await [Link]('Password').fill('password123')
await [Link]('button', { nam e: 'Login' }).click()
await expect(page).toHaveURL(/dashboard/)
await expect([Link]('welcom e-m sg')).toContainText('Welcom e')
})
Q67. Scenario: Test a shopping cart that adds and removes items, updating the
total price.
test('adds and rem oves cart item s', async ({ page }) => {
await [Link]('/shop')
await [Link]('add-to-cart').first().click()
await expect([Link]('cart-count')).toHaveText('1')
await [Link]('rem ove-item ').click()
await expect([Link]('cart-em pty-m sg')).toBeVisible()
})
Q68. Scenario: A form has conditional fields. Billing address appears only when a
checkbox is unchecked.
test('shows billing address when unchecked', async ({ page }) => {
await [Link]('/checkout')
await expect([Link]('sam e-as-shipping')).toBeChecked()
await expect([Link]('billing-address')).toBeHidden()
await [Link]('sam e-as-shipping').uncheck()
await expect([Link]('billing-address')).toBeVisible()
})
Q69. Scenario: An API call on page load fails with a 500 error. How do you test
the error state?
test('shows error banner on API failure', async ({ page }) => {
await [Link]('**/api/dashboard-data', async route => {
await [Link]({ status: 500, json: { m essage: 'Internal Server Error' } })
})
await [Link]('/dashboard')
await expect([Link]('error-banner')).toBeVisible()
await expect([Link]('retry-btn')).toBeVisible()
})
Q70. Scenario: Test a paginated table that loads more results on clicking Next.
test('m oves to next page', async ({ page }) => {
await [Link]('/users')
await expect([Link]('user-row')).toHaveCount(10)
await [Link]('next-btn').click()
await expect([Link]('page-info')).toContainText('Page 2')
})
Q71. Scenario: Test that a user cannot submit a form with an empty required field.
test('blocks subm ission for em pty required fields', async ({ page }) => {
await [Link]('/register')
await [Link]('subm it-btn').click()
await expect([Link]('em ail-error')).toBeVisible()
await expect(page).[Link](/success/)
})
Q72. Scenario: Write a test for a search feature with debounce.
test('shows search results after debounce', async ({ page }) => {
await [Link]('/search')
await [Link]('search-input').fill('playwright')
await expect([Link]('result-item ').first()).toContainText('Playwright')
})
Q73. Scenario: Test a multi-step wizard form with 3 steps and validation at each
step.
test('com pletes the wizard', async ({ page }) => {
await [Link]('/wizard')
await [Link]('first-nam e').fill('Alice')
await [Link]('next').click()
await expect([Link]('step-indicator')).toContainText('Step 2')
await [Link]('em ail').fill('alice@[Link] ')
await [Link]('next').click()
await [Link]('confirm -checkbox').check()
await [Link]('subm it').click()
await expect([Link]('success-m sg')).toBeVisible()
})
Q74. Scenario: Your test is flaky on toBeVisible(). How do you fix it?
1. Wait on the real API response or state change.
2. Confirm the locator is specific enough.
3. Check for overlays or animations.
4. Prefer toHaveText, toHaveCount, or URL assertions when they express the behavior better.
5. Use trace viewer and Inspector to inspect timing.
Q75. Scenario: Test a date picker component and verify the input updates.
test('selects a date', async ({ page }) => {
await [Link]('/booking')
await [Link]('date-picker').click()
await [Link]('next-m onth').click()
await [Link]('gridcell', { nam e: '15' }).click()
await expect([Link]('date-input')).toHaveValue('2026-05-15')
})
Q76. Scenario: You need to test an infinite scroll list. How do you verify more
items load?
test('loads m ore item s on scroll', async ({ page }) => {
await [Link]('/feed')
const list = [Link]('feed-list')
await expect([Link]('feed-item ')).toHaveCount(20)
await [Link](el => [Link] = [Link])
await expect([Link]('feed-item ')).toHaveCount(40)
})
Q77. Scenario: How do you test that an email was actually sent in an E2E test?
Trigger the email through the UI, then query a mail testing service such as MailHog, Mailpit,
or Mailtrap through an API client and assert recipient, subject, and body metadata, mirroring
the same approach suggested in the Cypress pack.[file:1]
Q78. Scenario: Write a test that verifies a CSV export button triggers a correct
download.
test('exports CSV', async ({ page }) => {
await [Link]('/users')
const downloadProm ise = [Link]('download')
await [Link]('export-csv').click()
const download = await downloadProm ise
expect([Link] e()).toContain('.csv')
})
Q79. Scenario: How do you test behavior that differs by user role?
Use parameterized tests with separate authenticated storage states or setup fixtures for
admin, viewer, and other roles.
Q80. Scenario: Test a real-time chat application where messages appear without
page refresh.
test('sends and shows chat m essages', async ({ page }) => {
await [Link]('/chat')
await [Link]('m essage-input').fill('Hello team !')
await [Link]('send-btn').click()
await expect([Link]('m essage-list')).toContainText('Hello team !')
})
Q81. Scenario: You have 200 tests and the suite takes 45 minutes. How do you
speed it up?
1. Reuse authentication with storageState .
2. Move setup to APIs.
3. Use parallel workers and sharding.
4. Remove fixed waits.
5. Run smoke tests separately.
6. Reduce unnecessary browser launches.
7. Capture traces only on retry or failure.
Q82. Scenario: Test a dropdown that loads options asynchronously from an API.
test('loads async dropdown options', async ({ page }) => {
await [Link]('/profile')
await [Link]('country-select').click()
await [Link]('option', { nam e: 'India' }).click()
await expect([Link]('country-select')).toContainText('India')
})
Q83. Scenario: Write a test that verifies only authorized users can access the
/adm in route.
test('redirects unauthenticated user to login', async ({ page }) => {
await [Link]('/adm in')
await expect(page).toHaveURL(/login/)
})
Q84. Scenario: An image carousel auto-advances every 3 seconds. How do you
test it without real timers?
Use [Link] where available in your version or mock timers in the app environment;
otherwise control the component through injected test hooks and assert slide state
deterministically.
Q85. Scenario: Test an autocomplete input that filters suggestions as you type.
test('filters suggestions', async ({ page }) => {
await [Link]('/search')
await [Link]('autocom plete-input').fill('pl')
await expect([Link]('suggestion-item ')).toContainText(['Playwright'])
})
Q86. Scenario: Test a modal dialog that opens, shows data, and closes on cancel.
test('opens and closes m odal', async ({ page }) => {
await [Link]('/users')
await [Link]('view-btn').first().click()
await expect([Link]('m odal')).toBeVisible()
await [Link]('m odal-cancel').click()
await expect([Link]('m odal')).toBeHidden()
})
Q87. Scenario: Test that a button is disabled while a form is submitting and re-
enabled after.
test('disables subm it during request', async ({ page }) => {
await [Link]('/register')
await [Link]('em ail').fill('test@[Link] ')
await [Link]('subm it').click()
await expect([Link]('subm it')).toBeDisabled()
})
Q88. Scenario: Test a feature flag that changes rendering based on localStorage.
test('shows beta feature', async ({ context, page }) => {
await [Link](() => {
[Link] ('featureFlags', [Link]({ betaChart: true }))
})
await [Link]('/dashboard')
await expect([Link]('beta-chart')).toBeVisible()
})
Q89. Scenario: Verify a table is sorted correctly when clicking a column header.
test('sorts table ascending', async ({ page }) => {
await [Link]('/products')
await [Link]('col-nam e').click()
const nam es = await [Link]('row-nam e').allTextContents()
const sorted = [...nam es].sort()
expect(nam es).toEqual(sorted)
})
Q90. Scenario: Write a reusable helper that seeds a user via API and logs in with
stored auth state.
Create a helper that calls a test-only seed endpoint, performs API login, saves storageState ,
and loads that state in subsequent tests.
Q91. Scenario: How do you test a toast notification that appears briefly after an
action?
test('shows a success toast', async ({ page }) => {
await [Link]('/settings')
await [Link]('display-nam e').fill('New Nam e')
await [Link]('save-btn').click()
await expect([Link]('toast')).toBeVisible()
await expect([Link]('toast')).toContainText('Saved successfully')
})
Q92. Scenario: Test that the browser back button restores the previous page
state correctly.
test('restores search state on back', async ({ page }) => {
await [Link]('/search')
await [Link]('filter-category').selectOption('Electronics')
await [Link]('search-input').fill('headphones')
await [Link]('search-btn').click()
await [Link]('result-item ').first().click()
await [Link]()
await expect([Link]('search-input')).toHaveValue('headphones')
})
Q93. Scenario: Your CI pipeline shows 15 tests failing in CI but passing locally.
How do you debug?
Check machine speed, missing environment variables, race conditions, viewport differences,
test data dependence, browser version mismatches, and external API flakiness. Use traces,
videos, screenshots, and HTML reports to compare CI behavior with local runs, which is the
Playwright counterpart to the CI-debug checklist in the Cypress pack.[file:1]
Q94. Scenario: How do you test geolocation-based UI behavior?
Create a context with geolocation coordinates and permission grants, then assert the app
renders the expected localized behavior.
Q95. Scenario: How do you validate a loading spinner disappears only after data
is rendered?
Assert the loading indicator becomes hidden and the final data container becomes visible with
the expected content.
Q96. Scenario: How do you test a same-origin iframe payment widget?
Use fram eLocator() to target the iframe contents and keep assertions scoped to the frame.
Q97. Scenario: How do you test a flaky third-party integration safely?
Mock the third-party network dependency for most tests and keep a small, separately
tagged contract or smoke suite against the real service.
Q98. Scenario: How do you test a user session timeout warning modal?
Control time through app hooks or mocked timers, then assert the warning modal appears
and the re-auth flow works.
Q99. Scenario: How do you verify analytics events fire after a user action?
Stub or observe the analytics network request and assert payload fields after the triggering
interaction.
Q100. Scenario: How do you design a maintainable Playwright framework for a
large product?
Use a layered design with stable locators, page objects only where they add value, shared
fixtures, API-based setup, project-level config, environment-aware test data, trace-first
debugging, and clear tagging for smoke, regression, and slow suites.
Tips & Best Practices
1. Prefer semantic locators first.
Use getByRole , getByLabel, and getByText where practical because they reflect what
users interact with and often make tests clearer.
2. Use data-testid for unstable UI structures.
When text or layout changes frequently, explicit test IDs reduce brittleness, just as the
Cypress pack recommends stable test selectors.[file:1]
3. Reuse authentication state.
Persist login with storageState or setup projects instead of repeating full UI login in
every test.
4. Use API setup for test data.
Seed users, carts, and orders through backend APIs whenever possible.
5. Avoid fixed sleeps.
Prefer locator assertions, URL waits, and response synchronization.
6. Keep tests user-centric.
Assert visible behavior, navigation, permissions, and outcomes instead of internal
implementation details.
7. Use traces on failure.
Tracing is one of Playwright’s biggest debugging advantages in CI.
8. Run projects across multiple browsers intentionally.
Do cross-browser runs where they add confidence, not as blind duplication.
9. Keep locators centralized when helpful.
For large suites, consistent locator naming reduces drift.
10. Use small, independent tests.
Isolation makes parallel runs and retries far more reliable.
Common Mistakes to Avoid
1. Overusing waitForTim eout().
2. Relying on brittle CSS selectors only.
3. Logging in through the UI in every test.
4. Ignoring trace artifacts in CI failures.
5. Using broad text locators that match multiple elements.
6. Mixing too much setup into each test body.
7. Not separating smoke and regression runs.
8. Reusing state unintentionally across tests.
9. Testing implementation details instead of behavior.
10. Running all third-party integrations live in every pipeline.
Must-Know Tools & Integrations
Playwright Trace Viewer — best for debugging failed CI runs.
HTML Reporter — quick execution overview with attachments.
Allure Reporter — richer dashboards in some enterprise setups.
Axe integrations — accessibility checks in UI flows.
APIRequestContext — fast backend setup and contract-style validations.
Docker + CI matrix — consistent browser execution across environments.
Mock Service Worker or route mocks — deterministic frontend testing.
Playwright Cheat Sheet
Navigation
await [Link]('/path')
await [Link]()
await [Link]()
await [Link]()
Locators
[Link]('.btn')
[Link]('button', { nam e: 'Login' })
[Link]('Subm it')
[Link]('Em ail')
[Link]('login-btn')
Actions
await [Link]()
await [Link]('text')
await [Link]()
await [Link]('IN')
await [Link]()
await [Link](target)
await [Link]('input[type=file]', 'sam [Link]')
Assertions
await expect(locator).toBeVisible()
await expect(locator).toBeHidden()
await expect(locator).toHaveText('Hello')
await expect(locator).toContainText('Hello')
await expect(locator).toHaveValue('input value')
await expect(locator).toBeChecked()
await expect(page).toHaveURL(/dashboard/)
Network
await [Link]('**/api/**', handler)
await [Link]('**/api/users')
await [Link]({ json: data })
await [Link]()
await [Link]()
Storage & Auth
await [Link]([...])
await [Link]()
storageState: '[Link]'
await [Link](() => [Link] ('k', 'v'))
CLI
npx playwright test
npx playwright test --headed
npx playwright test --debug
npx playwright show-report
npx playwright test --project=chrom ium
npx playwright test --grep @sm oke
Interview Prep Tracker
Easy Questions
[ ] Q1 What is Playwright and how is it different from Selenium?
[ ] Q2 What languages does Playwright support?
[ ] Q3 How do you install Playwright?
[ ] Q4 What is Playwright Test?
[ ] Q5 What is [Link]() used for?
[ ] Q6 How do you select elements in Playwright?
[ ] Q7 What is the recommended way to select elements for testing?
[ ] Q8 How do you type into an input field in Playwright?
[ ] Q9 How do you click a button in Playwright?
[ ] Q10 How do assertions work in Playwright?
[ ] Q11 What is the difference between locator and Elem entHandle ?
[ ] Q12 How do you intercept network requests in Playwright?
[ ] Q13 What is test data mocking in Playwright?
[ ] Q14 How do you handle dialogs in Playwright?
[ ] Q15 What is [Link]() in Playwright?
[ ] Q16 How do you run Playwright in headless mode?
[ ] Q17 What file structure does Playwright commonly use?
[ ] Q18 What is a fixture in Playwright?
[ ] Q19 How do you clear an input field in Playwright?
[ ] Q20 How do you take screenshots and videos in Playwright?
[ ] Q21 What is waitForTim eout() and when should you use it?
[ ] Q22 What is [Link]?
[ ] Q23 How do you create reusable helper methods in Playwright?
[ ] Q24 What does getByRole() do?
[ ] Q25 What is [Link]() used for?
[ ] Q26 What is APIRequestContext used for?
[ ] Q27 What is the default timeout in Playwright?
[ ] Q28 How do you check whether an element exists or is hidden?
[ ] Q29 What is the difference between hidden and detached?
[ ] Q30 How do you check a checkbox in Playwright?
[ ] Q31 How do you select from a dropdown in Playwright?
[ ] Q32 What is [Link]() used for?
[ ] Q33 How do you hover over an element in Playwright?
[ ] Q34 What is [Link]() or inputValue() used for?
[ ] Q35 What is browserContext used for?
Hard Questions
[ ] Q36 How does Playwright handle asynchronous code?
[ ] Q37 Why does Playwright work well with async/await?
[ ] Q38 What is the difference between page , context, and browser ?
[ ] Q39 How do you handle multi-tab or popup flows in Playwright?
[ ] Q40 What is storageState and when would you use it?
[ ] Q41 How do you test file uploads in Playwright?
[ ] Q42 How do you test file downloads in Playwright?
[ ] Q43 How do you set and read cookies in Playwright?
[ ] Q44 How do you speed up authentication in Playwright?
[ ] Q45 How do you perform API-only login in Playwright?
[ ] Q46 How does Playwright auto-waiting work?
[ ] Q47 How do [Link]() and [Link]() differ?
[ ] Q48 How do you test localStorage and sessionStorage?
[ ] Q49 How do you handle dynamic elements that appear after a delay?
[ ] Q50 How do you run Playwright tests in parallel?
[ ] Q51 How do you create custom fixtures in Playwright?
[ ] Q52 What is the Playwright project feature?
[ ] Q53 How do you handle browser permissions in Playwright?
[ ] Q54 How do you test drag and drop in Playwright?
[ ] Q55 How does Playwright handle shadow DOM?
[ ] Q56 What is the difference between locator() and fram eLocator()?
[ ] Q57 How do you debug Playwright tests?
[ ] Q58 How do you handle cross-browser testing in Playwright?
[ ] Q59 How do you configure retries for flaky tests?
[ ] Q60 How do you modify a request before it is sent?
[ ] Q61 What is the difference between [Link](), [Link](), and
[Link]()?
[ ] Q62 What is test isolation in Playwright?
[ ] Q63 How do you test WebSocket-heavy apps in Playwright?
[ ] Q64 How do you use Playwright Component Testing?
[ ] Q65 How do you measure performance-related behavior in Playwright?
Scenario Questions
[ ] Q66 Login redirects to dashboard on success
[ ] Q67 Shopping cart updates correctly
[ ] Q68 Conditional billing address field
[ ] Q69 API 500 error state
[ ] Q70 Pagination navigation
[ ] Q71 Required field validation
[ ] Q72 Debounced search
[ ] Q73 Multi-step wizard
[ ] Q74 Flaky visibility assertion
[ ] Q75 Date picker interaction
[ ] Q76 Infinite scroll loading
[ ] Q77 Email verification in E2E
[ ] Q78 CSV export validation
[ ] Q79 Role-based behavior
[ ] Q80 Real-time chat
[ ] Q81 Suite performance optimization
[ ] Q82 Async dropdown
[ ] Q83 Admin route authorization
[ ] Q84 Carousel timer behavior
[ ] Q85 Autocomplete filtering
[ ] Q86 Modal open and close
[ ] Q87 Disabled submit during request
[ ] Q88 Feature flag rendering
[ ] Q89 Table sorting
[ ] Q90 API seed plus auth helper
[ ] Q91 Toast notification
[ ] Q92 Browser back state restore
[ ] Q93 CI-only failures
[ ] Q94 Geolocation behavior
[ ] Q95 Spinner versus rendered data
[ ] Q96 Same-origin iframe widget
[ ] Q97 Third-party integration strategy
[ ] Q98 Session timeout warning
[ ] Q99 Analytics event validation
[ ] Q100 Maintainable framework design