checkly/puppeteer-to-playwright — 141★ on GitHub (JavaScript). Puppeteer to Playwright conversion script
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
puppeteer-to-playwright automatically converts Javascript Puppeteer scripts to Playwright, aiming to reduce the amount of manual work involved in such a migration (ideally reducing it to zero). It is heavily based on jscodeshift.
puppeteer-to-playwright requires Node.js 14 or newer.
Features
puppeteer-to-playwright will convert your existing Puppeteer script to Playwright, including:
Converting import statements
Converting basic methods to match new API (e.g. setViewport to setViewportSize and similar)
Creating browser context explicitly
Eliminating explicit waiting (unless Strict mode is enabled)
Converting cookies-related commands
Currently unsupported
The following features are not yet supported, meaning that the corresponding instructions won't be converted to Playwright if they are used in your Puppeteer script:
File upload
File download
Request/response interception
Multiple contexts / tabs
Still, these might very well be implemented in the near future. If you would like to help, see our how to contribute section.
Getting Started
You can use puppeteer-to-playwright on a script file or multiple scripts at a time.
🚨 It will overwrite the script file when run, so we recommend doing a dry-run first.
Dry run
A dry run will run the conversion without actually writing to the file(s) you point it at.
$ npm run convert -- -d my-puppeteer-script.js
You can add -p to print out the resulting script:
$ npm run convert -- -d -p my-puppeteer-script.js
You can pass additional jscodeshift parameters as described in the project's repository.
Convert script
You can convert scripts one by one...
$ npm run convert my-puppeteer-script.js
...or you can convert entire folders recursively.
$ npm run convert my-puppeteer-folder
puppeteer-to-playwright will ignore files that have any extension other than .js, as well as those that do not import/require Puppeteer.
Strict mode
When converting files, puppeteer-to-playwright will, by default, get rid of likely unnecessary waits that Playwright should handle automatically. If you know that the waits in your Puppeteer script will remain necessary even with Playwright, you can set puppeteer-to-playwright to Strict mode by running export STRICT=true. Alternatively, you can set the flag directly when converting a file or folder, e.g.:
STRICT=true npm run convert my-puppeteer-folder
How to contribute
If you would like to improve this codemod, you are very welcome to send a PR. Make sure it contains a test for the specific feature you are trying to add. Testing is currently set up as follows:
In test/base you have the original Puppeteer script
In test/output you have the original Puppeteer script, which will be automatically converted when tests are run then immediately restored to the original
In test/expected you have the expected Playwright script that your result will need to be equal to
You can run npm run test locally, and tests will run automatically for each new PR.
Links
jscodeshift - without which this project wouldn't be possible.
ASTExplorer - useful debugging tool in case you would like to modify the transform file of this project to tweak its output.
License
MIT
Code, test, and deploy synthetic monitoring at scale From Checkly with ♥️
Yes — checkly/puppeteer-to-playwright ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/checkly/puppeteer-to-playwright.
What is checkly/puppeteer-to-playwright?
checkly/puppeteer-to-playwright (checkly/puppeteer-to-playwright) is a JavaScript project on GitHub. From the project's own README: Puppeteer to Playwright conversion script
Where do I read more about checkly/puppeteer-to-playwright?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/checkly/puppeteer-to-playwright is the definitive source.
Read full README in the tab above.
Curious whether puppeteer-to-playwright is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about puppeteer-to-playwright.