Playwright interview questions — Hard
401 hard-level Playwright questions from our Automation Testing bank, each with the correct answer and an explanation of why it is correct.
What this covers
Playwright appears throughout Automation Testing interviews. At hard level, interviewers are typically checking depth under pressure — edge cases, failure modes, performance characteristics, and the trade-offs you accepted. Work through these, then explain your answer out loud; the second part is what interviews actually test.
6 example questions
1. Why are Playwright Locators preferred over page.$() element handles?
- A. Locators are evaluated lazily and re-resolved on each action, avoiding stale-element issues.correct
- B. Element handles auto-wait but locators do not.
- C. Locators only work for inputs.
- D. $() supports assertions and locators do not.
Why: Locators are lazy references re-resolved at action time (with auto-wait), so they avoid stale-element problems that raw element handles can hit.
2. Regarding Playwright, which of the following is a false statement?
- A. Expect(page).toHaveScreenshot() performs visual comparison against a stored baseline image.
- B. The Trace Viewer only records console logs, not DOM snapshots.correct
- C. Playwright can emulate mobile viewports, geolocation, locale, and permissions per context.
- D. Playwright can intercept network requests with page.route() and fulfill, modify, or abort them.
Why: The selected statement is false. The other options are accurate statements about Playwright.
3. Which statement about Playwright is NOT correct?
- A. Page.route() can observe requests but can never modify or block them.correct
- B. Playwright supports Chromium, Firefox, and WebKit through a single unified API.
- C. Playwright fixtures provide reusable setup/teardown and are composable per test.
- D. A BrowserContext in Playwright is an isolated, incognito-like session that is cheap to create.
Why: The selected statement is false. The other options are accurate statements about Playwright.
4. Which of the following statements about Playwright is FALSE?
- A. Playwright assertions evaluate exactly once and fail immediately if the condition is not yet true.correct
- B. A BrowserContext in Playwright is an isolated, incognito-like session that is cheap to create.
- C. The Playwright Trace Viewer records DOM snapshots, network activity, and console logs for post-mortem debugging.
- D. Test.describe.configure({ mode: 'serial' }) forces tests in a group to run one after another.
Why: The selected statement is false. The other options are accurate statements about Playwright.
5. Identify the INCORRECT statement about Playwright:
- A. Playwright fixtures provide reusable setup/teardown and are composable per test.
- B. Playwright supports API testing via the request fixture without launching a browser.
- C. The Playwright Trace Viewer records DOM snapshots, network activity, and console logs for post-mortem debugging.
- D. Playwright assertions evaluate exactly once and fail immediately if the condition is not yet true.correct
Why: The selected statement is false. The other options are accurate statements about Playwright.
6. In a CI/CD pipeline review, consider this: Playwright web-first assertions like toBeVisible() are special because they:
- A. Run once with no retry.
- B. Auto-wait and retry until met or timeout.correct
- C. Need a manual sleep.
- D. Only work headed.
Why: Web-first assertions auto-retry, reducing flakiness.