Hi all, I'm currently testing a browser application that includes a video player. Unfortunately, playwright browsers don't have the necessary codecs to play videos. Currently, I'm using my local Chrome installation with channel: chrome
in the project. Now, I would like to also test it in Firefox.
When I run my test in Firefox, a message appears indicating that Nightly is downloading some necessary components. After waiting for some time, the video starts to play. Is there a way to download and persist these components, so they don't need to be installed every time? It would be great to find a solution to install them once and for all. Alternatively, it would be acceptable to download them once per test run and then reuse them for all the tests in the suite.
Additionally, I have a bonus question: Can this be done for Chromium as well, so I can stop using the locally installed browser with the channel option?
This thread is trying to answer question "Is there a way to download and persist necessary components for video playback in Firefox and Chromium, so they don't need to be installed every time?"
Yes - it takes a long time to install the components. In headed mode I tried to wait long enough and the video finally started. But when I try it in headless mode, it fails in most cases (even with ridiculous timeouts like 5 mins). But it is weird, because sometimes a test takes like 1 minute and passes. But in another run it timesout
Doesn't using a channel for Chrome do the trick? https://playwright.dev/docs/browsers#google-chrome--microsoft-edge
Related Ask AI answer for "How do I manage browser downloads for video playback testing in Playwright?".
Sure, you can manage browser downloads for video playback testing in Playwright.
By default, Playwright downloads the latest Chromium version. But, you can specify a different version or browser by setting environment variables.
To download browsers into a specific location, use the PLAYWRIGHT_BROWSERS_PATH
environment variable. Here's how:
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install
If you manage browser binaries separately, you can skip browser downloads with the PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD
variable:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npx playwright install
Remember, Chromium may not have all the codecs bundled with Google Chrome or Microsoft Edge due to licensing. If your site relies on specific media codecs, it's recommended to use official channels such as Google Chrome or Microsoft Edge for testing.
For enterprise environments with policies that restrict certain capabilities or require mandatory extensions, using bundled Chromium for local testing is recommended.
Playwright's Firefox version matches the recent Firefox Stable build. Playwright does not work with branded versions of Firefox and instead relies on patches. Therefore, it is recommended to test against the recent Firefox Stable build when using Playwright with Firefox.
In short, Playwright gives you flexibility in managing browsers for testing video playback. You can specify a custom location for browser downloads, skip browser downloads altogether, and choose between different browsers based on their capabilities and your specific testing requirements.
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].