-
-
Notifications
You must be signed in to change notification settings - Fork 776
Playwright vs Puppeteer
Shubham Thakur edited this page Jun 24, 2023
·
22 revisions
⚡ Note:
playwright-extrais 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.
-
Puppeteerstarted as official Google project in 2017 and quickly gained popularity- It's considered to be the first "modern" browser automation tool, superseding projects like
SeleniumandPhantomJS
- It's considered to be the first "modern" browser automation tool, superseding projects like
-
Playwrightstarted 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
stealthandrecaptcha - 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-extrapackage now acts as a shared foundation for all drivers -
playwright-extra&puppeteer-extrahave transitioned to slim entry points forautomation-extra - New plugins will be based off
automation-extra-plugin, which supports bothPlaywright&Puppeteerevents
- A new
- Playwright support in the plugin framework doesn't mean all existing plugins can be used with Playwright immediately
- The existing
puppeteer-extraplugins need to be ported toautomation-extra-pluginand further optimized to be used with Firefox and Webkit
- The existing
- New plugins work with both
playwright-extraas well aspuppeteer-extraand usually all browsers - You can recognize new plugins by their package name:
@extra/foobaras 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/