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.

1 example questions

  1. 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.

Related Automation Testing topics