Video
当使用 recordVideo 选项创建浏览器上下文时,每个页面都会关联一个视频对象。
🌐 When browser context is created with the recordVideo option, each page has a video object associated with it.
console.log(await page.video().path());
方法
🌐 Methods
delete
Added in: v1.11删除视频文件。如有必要,将等待视频播放完成。
🌐 Deletes the video file. Will wait for the video to finish if necessary.
用法
await video.delete();
返回
path
Added before v1.9返回此视频将被记录到的文件系统路径。视频在关闭浏览器上下文时保证会写入文件系统。此方法在远程连接时会抛出异常。
🌐 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.
用法
await video.path();
返回
saveAs
Added in: v1.11将视频保存到用户指定的路径。可以在视频仍在进行中或页面已关闭后调用此方法,这样做是安全的。此方法会等待页面关闭并且视频完全保存完成。
🌐 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.
用法
await video.saveAs(path);
参数
返回