-
-
Notifications
You must be signed in to change notification settings - Fork 742
Playwright vs Puppeteer
Shubham Thakur edited this page Jun 24, 2023
·
22 revisions
β‘ Note:
playwright-extra
is now available.
- Playwright and Puppeteer are modern browser automation libraries to control real browsers with code
- Both are Node.js based and use the Chrome DevTools Protocol (CDP) behind the scenes
- They share the same roots and their APIs (e.g.
page.goto()
) are often the same or very similar
Switching them out later is relatively easy as their APIs are so similar, choose based on your current needs.
-
Choose Playwright
- If you need to use browsers other than Chrome/Chromium right now.
-
Choose Puppeteer
- If you rely on being able to use more pre-made plugins right now.
- If you rely on being able to use more pre-made plugins right now.
-
Puppeteer
started as official Google project in 2017 and quickly gained popularity- It's considered to be the first "modern" browser automation tool, superseding projects like
Selenium
andPhantomJS
- It's considered to be the first "modern" browser automation tool, superseding projects like
-
Playwright
started in 2020 after Microsoftboughthired a few of the core Puppeteer maintainers- They started fresh with prior experience: TypeScript and multi-browser support from the get go
- Both are actively maintained and push regular updates
- We started the project in 2018 with
puppeteer-extra
, a modular plugin framework for Puppeteer- We introduced popular plugins like
stealth
andrecaptcha
- Plugins are based off
puppeteer-extra-plugin
- We introduced popular plugins like
- We rewrote the plugin framework in 2020 to introduce additional support for Playwright
- A new
automation-extra
package now acts as a shared foundation for all drivers -
playwright-extra
&puppeteer-extra
have transitioned to slim entry points forautomation-extra
- New plugins will be based off
automation-extra-plugin
, which supports bothPlaywright
&Puppeteer
events
- A new
- Playwright support in the plugin framework doesn't mean all existing plugins can be used with Playwright immediately
- The existing
puppeteer-extra
plugins need to be ported toautomation-extra-plugin
and further optimized to be used with Firefox and Webkit
- The existing
- New plugins work with both
playwright-extra
as well aspuppeteer-extra
and usually all browsers - You can recognize new plugins by their package name:
@extra/foobar
as opposed topuppeteer-extra-plugin-foobar
- Playwright has first class support for Chromium, Firefox and Webkit browsers
- They accomplish this by maintaining a set of browser patches and shipping custom binaries
- They introduced a unified wire protocol which internally translates to CDP, Juggler, WDP
- Puppeteer has been heavily Chromium focussed and only recently added Firefox support to their core
- Instead of maintaining patches they work with the browser vendors to improve their CDP functionality
- Their Firefox support is currently no match for Playwright, even basic features are missing
- Both ship with their own Chromium version, a regular Chrome browser (ideally dev/canary versions) can be used as well
- The most noticeable difference between the two (in terms of API usage) is that Playwright leans heavily on the concept of browser contexts
- Playwright
-
Puppeteer
- GitHub | Documentation | API reference
- Is Puppeteer Firefox ready yet? https://puppeteer.github.io/ispuppeteerfirefoxready/