If you've noticed your server redownloading browsers when it's been idle, there's a way to prevent this. Playwright has a feature that removes unused browser versions, but you can opt out of this.
To keep all installed browser versions, set the PLAYWRIGHT_SKIP_BROWSER_GC=1
environment variable. This means Playwright won't remove any browser versions, even if they're not in use. This can be handy if you need specific browser versions for compatibility reasons.
Here's how you set the environment variable:
export PLAYWRIGHT_SKIP_BROWSER_GC=1
Once you've set this variable, Playwright won't remove unused browsers when updating. This means your server won't need to redownload browsers, even after being idle. However, this doesn't mean browsers will automatically update or apply security patches - you'll need to update Playwright for that.
By using PLAYWRIGHT_SKIP_BROWSER_GC=1
, you can keep your existing browser installations and avoid unnecessary downloads.
If you still have questions, please ask a question and I will try to answer it.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].