Instead of Selenium: Playwright
Use Playwright for new browser test suites. It drives Chromium, Firefox and WebKit through one API, waits for elements on its own, and comes with a test runner, tracing and parallel runs built in, where Selenium leaves you to assemble those pieces. If your Selenium scripts scrape or automate sites rather than test across browsers, you can instead keep Selenium and run it against Lightpanda, a lighter headless browser.
Both are for automating real browsers for end-to-end tests of web applications.
Why Playwright is better
- Before a click, Playwright checks that the element is visible, stable, enabled and receives events. Selenium's own docs call timing races one of the primary causes of flaky tests and leave the waiting strategy to you.
- Playwright Test bundles the runner, assertions, isolation, parallel runs, an HTML report and a trace viewer. With Selenium you add a test framework, a reporter and usually Selenium Grid yourself.
- It covers Safari's engine through WebKit on Windows, Linux and macOS, plus mobile emulation for Chrome on Android and Mobile Safari, and downloads the browsers it needs.
- Sharding across CI machines is one flag, --shard=1/4, with no grid to run.
- It has official bindings for JavaScript and TypeScript, Python, Java and .NET, so most Selenium teams can stay in their language.
When to keep Selenium
Keep Selenium when you need real Safari on macOS, a device cloud built around WebDriver, or a language such as Ruby or PHP that Playwright has no official binding for. A large, stable Selenium suite is not worth rewriting just to switch. For scraping, you can keep your Selenium scripts and run them on Lightpanda instead of Chrome. In Lightpanda's own benchmark, the 43 Selenium documentation tests that pass on both browsers ran 2.6x faster with 7.5x less memory.
Switching
Each test gets rewritten. Locators and actions map closely, so finding an element and clicking it becomes page.locator(...).click(), and most explicit waits can go. A practical path is to write new tests in Playwright and port old ones when they need changes, rather than converting the whole suite at once.
Watch out
Playwright tests against its own browser builds by default. It can also run the Chrome and Edge installed on the machine, but its WebKit build is not the Safari your users run. Microsoft controls Playwright, while Selenium implements the W3C WebDriver standard. If you take the Lightpanda route instead, note that its WebDriver support is new. Frames, alerts and Shadow DOM are not supported yet, and it cannot take real screenshots.
Also worth a look
- Lightpanda A headless browser without graphical rendering that speaks WebDriver; for scraping or functional checks of forms and text, keep your Selenium scripts and point them at it instead of chromedriver.
More newer, better browser automation tools and headless browsers
Sources
- Playwright: Installation and introduction
- Playwright: Auto-waiting
- Playwright: Sharding
- Playwright: Supported languages
- Selenium: Waiting strategies
- Playwright (software), Wikipedia
- Selenium (software), Wikipedia
- Speed up your Selenium scripts: Lightpanda now speaks WebDriver
Judged on 2026-11-06. See every browser automation tools and headless browsers, or all 66 replacements.