You can use a custom-built WebKit browser executable with Playwright by opting for a hermetic install. This mode lets you place binaries in the local folder.
To opt-in for hermetic install, set PLAYWRIGHT_BROWSERS_PATH=0
before running the install command:
npx playwright install
This places binaries in the node_modules/playwright-core/.local-browsers
directory.
If you manage browser binaries separately and want to skip browser downloads, set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD
before installation.
Playwright allows downloading browsers from a custom location using the PLAYWRIGHT_DOWNLOAD_HOST
environment variable. You can use per-browser download hosts using PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST
, PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST
and PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST
environment variables. These take precedence over PLAYWRIGHT_DOWNLOAD_HOST
.
When installing Playwright, you can ask it to download browsers into a specific location by setting the environment variable:
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install
When running Playwright scripts, ask it to search for browsers in a shared location:
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright test
In summary, Playwright provides multiple ways to use a custom-built WebKit browser executable. You can learn more about these methods in the Playwright documentation.
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].