playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Question] PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD variable not working

Open klendathu667 opened this issue 3 years ago • 3 comments

I am trying to setup playwright using node on my local in a corporate environment. we use artifactory, and while I can point to there and get playwright, we do not have the browser binaries. I've also used puppeteer, and for that, we just skipped the browser downloads and for our local setup pointed to our local chrome install. i'm trying to do the same thing with Playwright, but no matter how I set the variable for PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD, to "true", true, 1,) when I run npm init playwright, it still tries to download the browsers, and fails, so it never completely finishes the init process.

My npm config shows
PLAYWRIGHT_SKIP_DOWNLOAD_BROWSER= "true" (or "1", or "True")

Why is this still trying to download the browsers even though I have the variable set that should tell it to ignore that step?

Dan

klendathu667 avatar Sep 15 '22 21:09 klendathu667

Are you following the docs to have a custom CDN mirror? https://playwright.dev/docs/browsers#download-from-artifact-repository

You are using the wrong env var, it's: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 but you actually don't need it if you have a custom mirror, since you want to have it downloaded from it instead and you configure it via PLAYWRIGHT_DOWNLOAD_HOST .

mxschmitt avatar Sep 16 '22 09:09 mxschmitt

I don't have a custom mirror for the browser downloads, only for playwright itself. I don't want it to download any browsers, I want to point it to use the browser binaries I already have on my local system, just like I do with puppeteer. Even with the variable set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1, when I do npm init playwright, it still tries to download the browsers.

When using Puppeteer, I can skip the downloads, and point it to use my local installation of chrome like this:

PUPPETEER_EXECUTABLE_PATH="C:\Program Files (X86)\<path to chrome.exe"

I want to do the same for Playwright. Is that not possible> ? Is there NO way to have it skip the browser install step entirely?

klendathu667 avatar Sep 16 '22 11:09 klendathu667

Ah yeah this is expected, because npm init playwright is internally calling npx playwright install. Sounds like it needs improvement to me on our side.

mxschmitt avatar Sep 16 '22 11:09 mxschmitt

Proposed solution: npm init playwright@latest --no-browsers

dgozman avatar Sep 23 '22 17:09 dgozman

Hi ive started implementing Playwright tests on azure devops pipe, and those worked for me, to skip installation of additional browsers on agent:

      - script: npm ci
        displayName: "Install NPM"
        env:
          PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "true"

      - script: npx playwright install-deps
        displayName: "Install PlayWright"

UrbanovichA avatar Dec 28 '23 09:12 UrbanovichA