Rayrun

What is the purpose of the `PLAYWRIGHT_SKIP_BROWSER_GC=1` environment variable in Playwright?

Answer

Keeping Browsers in Playwright

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.

Setting the Environment Variable

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

What This Means for You

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.

References

Thank you!
Was this helpful?
Still have questions?

If you still have questions, please ask a question and I will try to answer it.

Related Discord Threads

Related Questions

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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 luc@ray.run.