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 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};
// JPEG with quality
let options = ScreenshotOptions::builder()
.screenshot_type(ScreenshotType::Jpeg)
.quality(80)
.build();
// Full page screenshot
let options = ScreenshotOptions::builder()
.full_page(true)
.build();
// Clip region
let clip = ScreenshotClip {
x: 10.0,
y: 10.0,
width: 200.0,
height: 100.0,
};
let options = ScreenshotOptions::builder()
.clip(clip)
.build();See: https://playwright.dev/docs/api/class-page#page-screenshot
Fields§
§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)
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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScreenshotOptions
impl Debug for ScreenshotOptions
Source§impl Default for ScreenshotOptions
impl Default for ScreenshotOptions
Source§fn default() -> ScreenshotOptions
fn default() -> ScreenshotOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ScreenshotOptions
impl RefUnwindSafe for ScreenshotOptions
impl Send for ScreenshotOptions
impl Sync for ScreenshotOptions
impl Unpin for ScreenshotOptions
impl UnsafeUnpin for ScreenshotOptions
impl UnwindSafe for ScreenshotOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more