pub fn screenshot_tab(
url: &str,
format: OutputFormat,
quality: u8,
visible_only: bool,
width: u16,
height: u16,
element: &str,
) -> Result<Vec<u8>, Error>Expand description
Take a screenshot of a webpage rendered in a Chrome tab.
§Arguments
- url: Web or file URL to render for screenshot.
- format: The output format to encode the screenshot as.
- quality: JPG quality. 0-100. This is ignored for PNGs and PDFs.
- surface: If true, screencap the entire rended HTML. If false, screencap what is visible inside the browser viewport dimensions.
- width: Width of the Chrome browser.
- height: Height of the Chrome browser.
- element: CSS selector to screenshot instead of the full page. Empty string screenshots whole page.
§Example
// Screenshot a page.
let image_data = screenshot_tab(
"file:////tmp/test.html",
OutputFormat::PNG, 80, false, 1024, 800, "")?;