How to migrate from Selenium to Playwright, with a step-by-step overview and how to overcome common challenges.


Selenium not cutting it for you anymore?
Tired of the constant workarounds needed to make Selenium work with modern web apps?
Thinking about all the hours the team could save if only Selenium did X, Y, or Z better?
Congratulations – you’ve reached the point where many engineering teams start to consider migrating from Selenium to Playwright. Here’s what you need to do, the challenges you should anticipate, and some alternative software suggestions.
Any new software implementation is a risk – so why take it?
In the case of Playwright and Selenium, it’s pretty clear that the efficiency gains you’ll get from Playwright far outweigh that risk. Here’s why:
Playwright runs tests faster thanks to its direct browser communication over WebSockets (no WebDriver layer).
Playwright automatically waits for elements to be actionable before testing. This means fewer flaky tests and less time spent coding complex workarounds – especially if you’re testing SPAs.
Selenium was released in 2004, Playwright in 2020. This means that Playwright is, naturally, better designed for modern testing needs – as well as SPAs, Playwright deals with shadow DOMs, network interception, and multiple browser contexts better than Selenium.
Playwright supports parallel testing out of the box. This offers a significantly easier and more efficient way of running parallel tests than Selenium, which relies on external tools.
Playwright has a built-in test runner and reporting features, so you don’t need to rely on third-party tools for test retries, tracing, screenshots, or HTML reports.
Migrating your tests from Selenium to Playwright requires technical know-how that we don’t really have space to go into in depth, mostly because the exact steps will vary between teams based on Selenium setup.
If you don’t have this expertise in-house, find a consultant who can advise you on your specific circumstances. A good one is worth the investment.
Still, it can be pretty useful to get an overview of what you need to do in a Selenium to Playwright migration, and when you need to do it. Here’s an at-a-glance guide for reference:
1. Audit your Selenium framework
2. Choose your Playwright language
3. Install Playwright in your project
4. Convert basic tests
5. Replace wait strategies
6. Rebuild Page Objects
7. Simplify parallel execution
8. Update CI/CD
9. Migrate gradually
10. Train your team
11. Start using Playwright’s advanced features
There will always be challenges in migrating from one piece of software to another. Migrating from Selenium might feel particularly intimidating, because for many teams, it’s the only test automation tool they have ever used!
The key is anticipating these challenges and planning how to address them in advance. Consider the following:
Migrating from Selenium to Playwright will only work if your users buy into the change, and embrace it. However, people are naturally change-resistant. This creates a dilemma.
(This doesn’t mean that your team are luddites – just that they’re following a natural ‘if it’s safe, why move’ evolutionary instinct). To alleviate:
You won’t be able to migrate all your tests at once – which means you’ll need to maintain both Selenium and Playwright as you complete the switch. If you don’t organize this properly, things could get pretty chaotic. Make sure to:
Yes and no. Software testing is faster, simpler, and easier to scale with Playwright. If you plan your migration properly, you’re likely to start realizing those efficiency gains relatively soon after implementing.
On the other hand, Playwright is no longer the creme de la creme of software testing tools. You’re still anchored to writing tests in code, and auto-waits don’t solve your ongoing test maintenance burden. If you’re looking to shift left and up your release cadence (and in this environment, you need to), Playwright will only get you halfway there.
AI tools like Momentic can 8x your release cadence and save 40 engineering hours per month (seriously), thanks to functionality that Playwright does not offer, including:
If you migrate from Selenium to Playwright now, chances are you’ll need to migrate again in a couple of years when you realize that AI offers steeper efficiency gains.
Why waste effort migrating to a system that’s on its way out? Migrate straight from Selenium to an AI-native testing tool to really see the difference.
"We went from 1-2 months for 80% user flow coverage to 1-2 days."
Aditya Advani, Best Parents
Momentic is an AI testing solution that’s designed to be intelligent, intuitive, and fast. Implement on Day 1, test on Day 1.
Here’s how Best Parents reached 80% user flow coverage in just one day after implementing Momentic – without writing a single line of code.
Want to join them? Talk to our engineering team today.