Rayrun
← Back to Discord Forum

Pre-install browsers in Docker container

I am trying to build up a docker container for CI with Playwright's dependencies and browsers already installed so my test stages can run more quickly. For now I'm trying to test only in Chromium to keep my pipeline reasonably quick.

I've tried running

npx playwright install-deps chromium

In the docker build and this appears to install the browser. However when I get to my test stage and I have to run npx playwright install chromium in my project, it appears to download the browser all over again.

Has anyone else achieved this and am I missing anything? The documentation specifically states that install-deps is useful in CI environments.

Thanks

This thread is trying to answer question "How can I pre-install browsers and dependencies in a Docker container for CI without re-downloading during the test stage?"

8 replies

Are you trying to build your own image from scratch and not base it on Playwright's images?

Yes

Can't use playwright's images as I'm using a gstreamer container with a ton of other stuff already installed

Hi, I think the behavior you're describing is normal. If you want dependencies plus browsers, you need to use: npx playwright install --with-deps chromium

If you want dependencies only, you use npx playwright install-deps

If you want browsers only, you use npx playwright install

@refactoreric: Ok I'm trying now with ``` npx playwright install --with-deps chromium ```

Ok I'm trying now with

npx playwright install --with-deps chromium

And will confirm result

Thanks that seems like it worked

The docs are a bit confusing on the differences between the commands I feel

Related Discord Threads

TwitterGitHubLinkedIn
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 [email protected].