Sure, you can set up a custom certificate for a proxy with Playwright. If your proxy's requests are intercepted with a custom untrusted certificate authority (CA) and you're seeing an "Error: self signed certificate in certificate chain" while downloading browsers, you can set your custom root certificates via the NODE_EXTRA_CA_CERTS environment variable before installing the browsers.
Here's how you can do it:
export NODE_EXTRA_CA_CERTS="/path/to/cert.pem"
Once you've set this environment variable, go ahead and install Playwright. It will use your custom root certificates when downloading browsers.
If you're configuring Playwright to download browsers from an internal artifact repository instead of Microsoft's CDN, you can use the PLAYWRIGHT_DOWNLOAD_HOST environment variable. This lets you specify a custom location for downloading browser binaries.
Remember, these configurations are specific to Playwright and may not apply in other contexts or frameworks. Always refer to Playwright's documentation for more detailed instructions on how to configure proxies and certificates.
In a nutshell, by setting the NODE_EXTRA_CA_CERTS environment variable with your custom root certificates and configuring PLAYWRIGHT_DOWNLOAD_HOST if necessary, you can set up a custom cert for a proxy in Playwright.
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].