pub struct Video { /* private fields */ }Expand description
Video represents a video recording of a page.
Video recording is enabled by passing record_video to
Browser::new_context_with_options(). Each page in the context receives
its own Video object accessible via page.video().
The underlying recording is backed by an Artifact whose GUID is provided
in the Page initializer. Methods that access the file wait for the
artifact to become ready before acting — in practice this happens almost
immediately, but calling path() or save_as() before the page is closed
may return an error if the artifact hasn’t finished writing.
Implementations§
Source§impl Video
impl Video
Sourcepub async fn path(&self) -> Result<PathBuf>
pub async fn path(&self) -> Result<PathBuf>
Returns the file system path of the video recording.
The recording is guaranteed to be written to the filesystem after the browser context closes. This method waits up to 10 seconds for the recording to be ready.
Sourcepub async fn save_as(&self, path: impl AsRef<Path>) -> Result<()>
pub async fn save_as(&self, path: impl AsRef<Path>) -> Result<()>
Saves the video recording to the specified path.
This method can be called while recording is still in progress, or after the page has been closed. It waits up to 10 seconds for the recording to be ready.
See: https://playwright.dev/docs/api/class-video#video-save-as
Sourcepub async fn delete(&self) -> Result<()>
pub async fn delete(&self) -> Result<()>
Deletes the video file.
This method waits up to 10 seconds for the recording to finish before deleting.
See: https://playwright.dev/docs/api/class-video#video-delete