Skip to main content
Use Playwright’s getDisplayMedia API with Chrome flags to record audio playing in a browser tab. The recording is saved as a .webm file that can be downloaded and analyzed.
Playwright initializes the fake audio device once per browser instance. You cannot swap audio sources mid-flow. If you need to record different audio content, launch a new browser instance for each.

Examples

Record audio from a browser tab
Download audio from a page element If your app exposes audio via a <video> or <audio> element, download it directly without screen capture:

When to use

  • Your app streams or plays audio and you need to verify the correct audio played.
  • Your app generates audio output and you need to capture it for analysis.
  • Your test needs to validate audio content that can’t be asserted through the UI.
  • Your app has a media player and you need to confirm playback works end to end.

Full sample test

Last modified on May 20, 2026