I am hosting a playwright application that runs on heroku. I have used Springboot for the application. I have a problem, if my server is not used for a little while, it redownloads the browsers again & again. I have attached an image of the logs from my applicaiton that show the downloads. How can I make it so, once them downloads have happened once, no redownloads are needed/
This thread is trying to answer question "How can I prevent my server from redownloading the browsers every time it is not used for a while?"
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:
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.
PLAYWRIGHT_SKIP_BROWSER_GC=1, you can keep your existing browser installations and avoid unnecessary downloads.
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 firstname.lastname@example.org.