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.
5 example questions
1. Regarding Playwright, which of the following is a false statement?
- A. GetByRole() locates elements by their ARIA role and accessible name, making tests resilient to DOM changes.
- B. Playwright web-first assertions with expect() automatically retry until the condition is met or the timeout expires.
- C. Playwright can only test Chromium-based browsers.correct
- D. Playwright can emulate mobile viewports, geolocation, locale, and permissions per context.
Why: The selected statement is false. The other options are accurate statements about Playwright.
2. Which of the following statements about Playwright is FALSE?
- A. Playwright's codegen tool records user interactions and generates test code.
- B. BrowserContexts share cookies and localStorage with each other by default.correct
- C. Playwright web-first assertions with expect() automatically retry until the condition is met or the timeout expires.
- D. The Playwright Trace Viewer records DOM snapshots, network activity, and console logs for post-mortem debugging.
Why: The selected statement is false. The other options are accurate statements about Playwright.
3. Which statement about Playwright is NOT correct?
- A. Playwright's auto-waiting performs actionability checks (visible, stable, enabled) before interacting with an element.
- B. StorageState allows Playwright to reuse authenticated session state across tests.
- C. GetByRole() is discouraged in favor of XPath as the most resilient locator strategy.correct
- D. Playwright can emulate mobile viewports, geolocation, locale, and permissions per context.
Why: The selected statement is false. The other options are accurate statements about Playwright.
4. Identify the INCORRECT statement about Playwright:
- A. Playwright runs test files in parallel by default using worker processes.
- B. A BrowserContext in Playwright is an isolated, incognito-like session that is cheap to create.
- C. GetByRole() is discouraged in favor of XPath as the most resilient locator strategy.correct
- 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. In a test-strategy meeting, the question comes up: 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.