← Back to Discord Forum

Skip browser downloading in Playwright Java

How would you stop Playwright from downloading browsers?


This thread is trying to answer question "How can you stop Playwright from downloading browsers when trying to connect to a provided instance of a headless chrome browser?"

5 replies
object Browser {
  private lateinit var browser: Browser
  init {
    try {
      browser = Playwright.create().chromium().connectOverCDP(
        Config().getCredential("headlessbrowser").let {
    } catch (e: Exception) {

I think when you run a new PW version with old browser versions, your tests can't run. But might be wrong.

@.aleksandaraleksandrov: My hosting optionally provides an instance of headless chrome browser, to which I'd like to connect.

My hosting optionally provides an instance of headless chrome browser, to which I'd like to connect.

In that case, I won't need to download browsers, right?


hmmm, not sure. If the current version only works with specific browser versions, this might be a problem. But I think you need to bring the question to the PW team


Managing Browser Downloads in Playwright

If you're managing browser binaries separately and want to skip browser downloads, set the PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD variable before installation. Run this command:


You can also opt for a hermetic install and place binaries in a local folder. Set the PLAYWRIGHT_BROWSERS_PATH environment variable. This command places the binaries in the specified location:

PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install

Remember, setting PLAYWRIGHT_BROWSERS_PATH doesn't change the installation path for Google Chrome and Microsoft Edge.

Playwright has a "stale browser removal" feature. By default, it keeps track of clients that use its browsers and deletes versions that are no longer needed. If you want to keep all installed browsers, set the PLAYWRIGHT_SKIP_BROWSER_GC environment variable to 1.

To uninstall browsers of your current Playwright installation (chromium, firefox, webkit), run:

npx playwright uninstall

To remove browsers from other Playwright installations on your system, pass the --all flag:

npx playwright uninstall --all

For the most up-to-date instructions, always refer to the official Playwright documentation.

Related Discord Threads

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.