I have used Selenium for several years to automate UI tests, one of our new devOps guys used to be a QA and he introduced me to Playwright recently. On the surface it seems like Playwright solves a bunch of the issues that I've had with Selenium. Built in waits, a test builder that's actually useful for grabbing stubborn locators, etc. So I then presented the advantages to my manager while making sure to let her know that Selenium can still be used so we don't have to re-write all the existing automation. However, she's hesitant to make any changes, partly because playwright is so new and there's not as much community support. I'm curious if there are more advantages to playwright that people have come across while using it to strengthen my argument? Thanks in advance.
it depends, for example * corporate enviroment raises demand for testing in firefox 92, unfortunatly it seems like pw is bleeding edge browser version only * corporate enviroment raises demand for running in some redhat - it looks like pw is hardoded as "ubuntu only" could you please state your demands for unit testing framework?– jonnyFeb 22 at 10:14
Oh, the "newness" argument. Well, that's technology; we are a sector of newness.
Anyway, to help with the newness argument, Playwright isn't exactly "new." What do I mean by this?
The team that created Playwright first created Puppeteer while on the Chromium team at Google in January 2018. One limitation of Puppeteer includes only being able to work with Chromium-based browsers.
This team wanted to extend Puppeteer but where not allowed to. So, they left Google/Chromium team and went to Microsoft, where they forked Puppeteer to create Playwright in January 2020. They wanted to fix their mistakes and extend this tool for any browser and for both web, API, and mobile usage.
As for the support of Playwright, yep, it is one of Microsoft's many open-source contributions and they are fully behind its support! And Playwright is gaining in popularity every month.
My Background: I am someone who migrated an automation suite of 5000+ tests from Protractor(Selenium) to Playwright effectively , below are my few insights:
- Reduced execution time from 10 hrs to 1.5 to 2 hrs (5 times)
- More stable with auto-waiting feature and right coding approach handling promises.
- Reusability :Re-used 40-50% of scripts code written in jasmine to playwright-Test, as-is.
- Excellent Microsoft level Documentation.
- Good support for API testing - from UI tests as well as well as standalone API tests.
Reducing execution time 5 times with stability is itself enough reason to switch in CI pipelines for faster response time.
Playwright is rapidly gaining acceptance and becoming industry standard. I have seen Playwright listed in job ads but have not seen mentions in any resumes yet. Keep in mind that the ability to quickly adapt to change will always be a competitive advantage.
One of our teams has started building a new test framework using Playwright. Here are some of the highlights:
- Playwright can be used with the language of your choice
- Auto-waits work very well
- Playwright can send and receive API requests
- Playwright can interact with devtools
- Trace Viewer is helpful for developers
- Playwright offers a Visual UI testing feature
- PageObject, Assertions, Screenshots, and Geolocation are built-in
I am not fully sure what kind of arguments may be important, but let us give it a try:
I know that the speed is not the most important thing, but sometimes it can be taken into account.
Playwright may be faster than
Selenium (See https://blog.checklyhq.com/puppeteer-vs-selenium-vs-playwright-speed-comparison/#why-compare-these-automation-tools).
Additionally, one can argue that: it is more concise when it comes to code, plus there are many features out of the box.
When long-term project is considered, it can be pointed out that
Playwright is supported by Microsoft and is positively perceived by developers, hence, probably its popularity will grow.