tauri-apps/wry

Add screenshot capability

zakhenry opened this issue · 0 comments

Is your feature request related to a problem? Please describe.
I want to be able to capture screenshots of the webview, specifically from the rust side both for integration testing and as a part of error reporting when the webview is in an untrusted state.

Describe the solution you'd like
On the WebviewWindow, I'd like a method async capture_screenshot() -> Bytes or similar.

Describe alternatives you've considered
It might be possible to have the capture performed by the javascript, though this might be untrustworthy if the webapp is in a broken state.

Additional context
webkit ref: https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot
chromiumoxide ref: https://docs.rs/chromiumoxide/latest/chromiumoxide/page/struct.Page.html#method.screenshot