javaheadlessplaywright

Java Playwright + Browserless ignore browser download


I am developing a simple prototype with Java + Playwright + Browserless. I was wondering if it's possible to avoid downloading the browsers in AWS.

Playwright build of chromium v956323 downloaded to /home/ec2-user/.cache/ms-playwright/chromium-956323
Playwright build of ffmpeg v1007 downloaded to /home/ec2-user/.cache/ms-playwright/ffmpeg-1007
Playwright build of firefox v1313 downloaded to /home/ec2-user/.cache/ms-playwright/firefox-1313
Playwright build of webkit v1596 downloaded to /home/ec2-user/.cache/ms-playwright/webkit-1596

Sometimes it will run in browserless and I think if so I won't need the browser but I don't really know is this possible. Or even running in browserless would I need the browsers?

If so, how can I do that in Java?

I want to do it programmatically because depending of the parameters sometime I need them, sometimes I don't; is this possible?


Solution

  • You can skip the browser download by setting an environment variable PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1

    See the docs here: https://playwright.dev/java/docs/browsers#skip-browser-downloads