Version: 1.10.0


Playwright can record videos for all pages in a browser context. Videos are saved upon context closure, so make sure to await browser_context.close().

context = browser.new_context(record_video_dir="videos/")
# Make sure to close, so that videos are saved.

You can also specify video size, it defaults to viewport size scaled down to fit 800x800.

context = browser.new_context(
record_video_size={"width": 1024, "height": 768}

Saved video files will appear in the specified folder. They all have generated unique names. For the multi-page scenarios, you can access the video file associated with the page via the

path =

Note that the video is only available after the page or browser context is closed.

API reference#