| 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" });<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
<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
<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
Returns
<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
optionsVideoStartOptions?(optional)-
SizeSize? (optional)#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
<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
Returns