pub struct ScreenshotBuilder<'a> { /* private fields */ }Expand description
Builder for configuring and capturing screenshots.
Uses the browser’s native screenshot API (browser.tabs.captureVisibleTab)
for accurate pixel capture without JavaScript limitations.
§Example
ⓘ
// Capture as PNG base64
let png_data = tab.screenshot().png().capture().await?;
// Capture as JPEG and save to file
tab.screenshot().jpeg(80).save("page.jpg").await?;Implementations§
Source§impl<'a> ScreenshotBuilder<'a>
impl<'a> ScreenshotBuilder<'a>
Sourcepub fn format(self, format: ImageFormat) -> Self
pub fn format(self, format: ImageFormat) -> Self
Sets the image format.
Sourcepub async fn capture(&self) -> Result<String>
pub async fn capture(&self) -> Result<String>
Captures the screenshot and returns base64-encoded data.
Uses the browser’s native captureVisibleTab API for accurate capture.
Sourcepub async fn capture_bytes(&self) -> Result<Vec<u8>>
pub async fn capture_bytes(&self) -> Result<Vec<u8>>
Captures the screenshot and returns raw bytes.
Auto Trait Implementations§
impl<'a> Freeze for ScreenshotBuilder<'a>
impl<'a> !RefUnwindSafe for ScreenshotBuilder<'a>
impl<'a> Send for ScreenshotBuilder<'a>
impl<'a> Sync for ScreenshotBuilder<'a>
impl<'a> Unpin for ScreenshotBuilder<'a>
impl<'a> !UnwindSafe for ScreenshotBuilder<'a>
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