playwright: [BUG] Error: browserType.launch: Failed to launch chromium because executable doesn't exist at /home/jenkins/.cache/ms-playwright/chromium-844399/chrome-linux/chrome

Context:

  • Playwright Version: [1.8]
  • Operating System: [Unix / jenkins]
  • Node.js version: [10.14]
  • Browser: Chromium]

We are attempting to install playwright thru yarn but it fails intermittently with this error. Our project is monorepo and uses “yarn”

any idea how to resolve this issue?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 8
  • Comments: 20 (4 by maintainers)

Most upvoted comments

i found that working too https://playwright.dev/docs/browsers#managing-browser-binaries-1

fixed with two env vars in our github actions and changed command order (npx playwright install after yarn install)

env:
  PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 # Skip downloading during yarn install
  PLAYWRIGHT_BROWSERS_PATH: 0 # Places binaries to node_modules/@playwright/test

jobs:
  e2e:
    runs-on: ubuntu-latest

    steps:
      - name: Install dependencies
        run: |
            npx playwright install-deps

      - name: Setup
        run: |
            yarn install
            npx playwright install

How can I force download the Chromium Binary only?

You can use playwright command line interface to install the browser:

npx playwright install chromium

It passes intermittently so I doubt it’s SKIPPING the browser download. It does not install with yarn command, and behaves flaky.

I’m not familiar with Jenkins, does it merely run the same script as you do locally or does it get a copy of files created by running the installation scripts elsewhere? Like I said if the browser hasn’t been downloaded the install step should fail.

@tanvee38 this sounds like a different bug, it’d be better to discuss it separately. Also it’d be helpful if you could share your Dockerfile.

@vaghelmt - We use https://codecept.io/ to run our tests on both Playwright as well as on Web drivers.

npx playwright install does not always install libraries, and it’s been a known issue for a long.

So, as per the medium artical, we pre-installed the Browser Binaries in our CI Docker, and SKIP the browser downloads during npx playwright install. It’s a very generic approach regardless of the framework, and it works for us. Let me know if you face any issues!

Just to add to this. I am setting up playwright tests in gitlab CI. When running npm ci it installs different builds of the browsers

Playwright build of chromium v901522 downloaded to /root/.cache/ms-playwright/chromium-901522
Playwright build of ffmpeg v1005 downloaded to /root/.cache/ms-playwright/ffmpeg-1005
Playwright build of firefox v1278 downloaded to /root/.cache/ms-playwright/firefox-1278
Playwright build of webkit v1516 downloaded to /root/.cache/ms-playwright/webkit-1516

But when running tests, it expects different build

browserType.launch: Failed to launch chromium because executable doesn't exist at /root/.cache/ms-playwright/chromium-888113/chrome-linux/chrome

Some implementation details: the way playwright works is it downloads corresponding chromium revision into the .cache folder (/home/jenkins/.cache/ms-playwright/chromium-844399 in your case) and then when you run the tests it will try to launch chromium from that directory.

Error: browserType.launch: Failed to launch chromium because executable doesn't exist at /home/jenkins/.cache/ms-playwright/chromium-844399/chrome-linux/chrome error indicates that the file is not there, perhaps it gets deleted by someone intermittently. You need to find out why the content of /home/jenkins/.cache/ms-playwright/chromium-844399/ changes between the installation and test runs.