Always Be Updating
Learn the simple steps to update Playwright and its browsers so you're always running with the latest features and fixes.
Everyone knows that Playwright is a powerful tool for browser automation, but like any evolving framework, it benefits from regular updates. Staying current ensures you have the latest bug fixes, security patches, and new features. Here's how to keep your Playwright setup up to date in just a few steps.
Step 1: Check for Updates
First, use npm to see if an update is available for Playwright:
npm outdated @playwright/test
If an update is listed, you're ready to move forward.
Step 2: Update Playwright
Run the following command to update Playwright and its browser binaries:
npm install @playwright/test@latest
Then, download the latest browser versions:
npx playwright install
Step 3: Verify Your Installation
Confirm that Playwright is using the latest version:
npx playwright --version
Step 4: Test Your Code
After updating, it's a good idea to rerun your tests and make sure nothing breaks:
npx playwright test
Bonus: Automate the Check
Add this script to your package.json
to check for updates regularly:
"scripts": {
"check-playwright-update": "npm outdated @playwright/test"
}
Then run it with:
npm run check-playwright-update