Selenium · Browser automation foundations
How does Selenium compare with Playwright?
Short answer
Selenium drives installed browsers through WebDriver and has the broadest ecosystem. Playwright controls its own patched browser builds directly, with built-in auto-waiting, network interception, tracing and a test runner.
The architectural difference drives most of the practical ones. Selenium sends discrete HTTP commands to a driver. Playwright keeps a persistent connection to a browser it ships itself, so it can observe page events and retry actions with actionability checks.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
WebElement save = wait.until(
ExpectedConditions.elementToBeClickable(By.cssSelector("[data-testid='save']")));
save.click();
wait.until(ExpectedConditions.textToBePresentInElementLocated(
By.cssSelector("[role='status']"), "Saved"));- Selenium supports Java, Python, JavaScript, C#, Ruby and Kotlin; Playwright supports fewer languages
- Selenium has mature Grid and cloud-provider integrations and a very large legacy footprint
- Playwright bundles browser builds, a runner, fixtures, tracing and network mocking
- Selenium needs explicit waits by default; Playwright actions auto-wait for actionability
- Selenium can attach to existing browser sessions more flexibly through debugging ports and remote URLs
- Both can run headless, in parallel and in containers, and both can make API calls through extra libraries
I choose Selenium when the organisation already runs Grid, needs a language or browser that Playwright does not cover well, or must reuse existing Selenium skills and infrastructure. For a greenfield JavaScript or Python browser suite, Playwright usually reduces wait code and debugging effort.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1When would you still pick Selenium over Playwright?
- 2Does Selenium support automatic waiting?
- 3How does network interception differ between the two?
- 4Which tool has better cross-language support?
Say it in the interview
Selenium uses the W3C WebDriver protocol and a separate driver per browser, which gives it broad language and browser coverage plus a mature Grid ecosystem. Playwright ships its own browsers and controls them directly, so it gets auto-waiting, tracing, request interception and a test runner in one package. I pick Selenium for existing Grid or language constraints, and Playwright for new suites where developer experience matters most. Either can be stable if locators and waits are designed well.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Selenium mock interview and get scored feedback on depth, clarity and confidence.