#[non_exhaustive]pub struct ScreenshotOptions {
pub screenshot_type: Option<ScreenshotType>,
pub quality: Option<u8>,
pub full_page: Option<bool>,
pub clip: Option<ScreenshotClip>,
pub omit_background: Option<bool>,
pub animations: Option<Animations>,
pub caret: Option<Caret>,
pub scale: Option<Scale>,
pub style: Option<String>,
pub mask: Option<Vec<Value>>,
pub mask_color: Option<String>,
pub timeout: Option<f64>,
}Expand description
Screenshot options
Configuration options for page and element screenshots.
Use the builder pattern to construct options:
§Example
use playwright_rs::protocol::{ScreenshotOptions, ScreenshotType, ScreenshotClip};
use playwright_rs::Animations;
// JPEG with quality
let options = ScreenshotOptions::builder()
.screenshot_type(ScreenshotType::Jpeg)
.quality(80)
.build();
// Stable screenshot: freeze animations and hide the caret
let options = ScreenshotOptions::builder()
.animations(Animations::Disabled)
.build();See: https://playwright.dev/docs/api/class-page#page-screenshot
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.screenshot_type: Option<ScreenshotType>Image format (png or jpeg)
quality: Option<u8>JPEG quality (0-100), only applies to jpeg format
full_page: Option<bool>Capture full scrollable page
clip: Option<ScreenshotClip>Clip region to capture
omit_background: Option<bool>Hide default white background (PNG only)
animations: Option<Animations>Freeze CSS animations and transitions before capturing (stable shots)
caret: Option<Caret>Hide or keep the text caret
scale: Option<Scale>CSS-pixel vs device-pixel scale
style: Option<String>CSS to inject into the page before capturing (e.g. hide dynamic elements)
mask: Option<Vec<Value>>Locators to mask out (overpaint) with a solid box, pre-serialized to the
protocol { frame, selector } shape. Build via the builder’s mask.
mask_color: Option<String>CSS color of the mask boxes (e.g. "#FF00FF"); Playwright defaults to pink.
timeout: Option<f64>Screenshot timeout in milliseconds
Implementations§
Source§impl ScreenshotOptions
impl ScreenshotOptions
Sourcepub fn builder() -> ScreenshotOptionsBuilder
pub fn builder() -> ScreenshotOptionsBuilder
Create a new builder for ScreenshotOptions
Trait Implementations§
Source§impl Clone for ScreenshotOptions
impl Clone for ScreenshotOptions
Source§fn clone(&self) -> ScreenshotOptions
fn clone(&self) -> ScreenshotOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more