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)
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 installafteryarn install)You can use playwright command line interface to install the browser:
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 installdoes 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 ciit installs different builds of the browsersBut when running tests, it expects different build
I still have this issue but I ended up resolving it thru this > https://gkushang.medium.com/playwright-failed-to-launch-browsers-how-to-solve-8b01d03fe5b9
@broncha
Some implementation details: the way playwright works is it downloads corresponding chromium revision into the .cache folder (
/home/jenkins/.cache/ms-playwright/chromium-844399in 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/chromeerror 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.