Sure, let's dive into how Playwright manages browser dependencies and how you can configure it to download browsers from custom locations.
Playwright keeps track of the packages that need browsers and cleans them up as you update to newer versions. You can opt-in for this mode by adding the following line to your .bashrc
:
export PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers
This tells Playwright to manage and track browser dependencies based on the packages you're using.
By default, Playwright downloads browsers from Microsoft's CDN. But if your company maintains an internal artifact repository to host browser binaries, you can configure Playwright to download from your custom location. Just set the PLAYWRIGHT_DOWNLOAD_HOST
environment variable:
export PLAYWRIGHT_DOWNLOAD_HOST=https://ray.run/your-custom-location
If your company uses an internal proxy that blocks direct access to public resources, you can configure Playwright to download browsers via a proxy server. Set the HTTPS_PROXY
environment variable:
export HTTPS_PROXY=https://ray.run/your-proxy-server
That's it! Now you know how to manage browser dependencies and configure Playwright to download browsers from custom locations. For more tips and tricks, check out our blog.
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].