Skip to content

Latest commit

 

History

History
211 lines (156 loc) · 9.3 KB

File metadata and controls

211 lines (156 loc) · 9.3 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.WriteLine(await page.Video.GetPathAsync());

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

await page.Video.StartAsync();
// ... perform actions ...
await page.Video.StopAsync(new() { Path = "video.webm" });

Methods

DeleteAsync {#video-delete}

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

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

Usage

await Video.DeleteAsync();

Returns


PathAsync {#video-path}

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

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.PathAsync();

Returns


SaveAsAsync {#video-save-as}

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

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.SaveAsAsync(path);

Arguments

  • path string#

    Path where the video should be saved.

Returns


StartAsync {#video-start}

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

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

Usage

await page.Video.StartAsync();
// ... perform actions ...
await page.Video.StopAsync(new() { Path = "video.webm" });

Arguments

  • options VideoStartOptions? (optional)
    • Size Size? (optional)#

      • Width int

        Video frame width.

      • Height int

        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


StopAsync {#video-stop}

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

Stops video recording started with Video.StartAsync() and either saves or discards the video file.

Usage

await Video.StopAsync(options);

Arguments

  • options VideoStopOptions? (optional)
    • Path string? (optional)#

      Path where the video should be saved.

Returns