Skip to content

Latest commit

 

History

History
243 lines (189 loc) · 11.1 KB

File metadata and controls

243 lines (189 loc) · 11.1 KB
id class-video
title Video

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import HTMLCard from '@site/src/components/HTMLCard';

When browser context is created with the recordVideo option, each page has a video object associated with it.

console.log(await page.video().path());

Alternatively, you can use video.start() and video.stop() to record video manually. This approach is mutually exclusive with the recordVideo option.

await page.video().start();
// ... perform actions ...
await page.video().stop({ path: 'video.webm' });

Methods

delete {#video-delete}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11video.delete

Deletes the video file. Will wait for the video to finish if necessary.

Usage

await video.delete();

Returns


path {#video-path}

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9video.path

Returns the file system path this video will be recorded to. The video is guaranteed to be written to the filesystem upon closing the browser context. This method throws when connected remotely.

Usage

await video.path();

Returns


saveAs {#video-save-as}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.11video.saveAs

Saves the video to a user-specified path. It is safe to call this method while the video is still in progress, or after the page has closed. This method waits until the page is closed and the video is fully saved.

Usage

await video.saveAs(path);

Arguments

  • path string#

    Path where the video should be saved.

Returns


start {#video-start}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59video.start

Starts video recording. This method is mutually exclusive with the recordVideo context option.

Usage

await page.video().start();
// ... perform actions ...
await page.video().stop({ path: 'video.webm' });

Arguments

  • options Object (optional)
    • size Object (optional)#

      • width number

        Video frame width.

      • height number

        Video frame height.

      Optional dimensions of the recorded video. If not specified the size will be equal to page viewport scaled down to fit into 800x800. Actual picture of the page will be scaled down if necessary to fit the specified size.

Returns


stop {#video-stop}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.59video.stop

Stops video recording started with video.start().

Usage

await video.stop();
await video.stop(options);

Arguments

  • options Object (optional)
    • path string (optional)#

      Path where the video should be saved.

Returns