Bug 237208 - Web Inspector: `console.screenshot` like API that returns image object
Summary: Web Inspector: `console.screenshot` like API that returns image object
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: Safari 15
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-02-25 06:37 PST by Christopher Atlan
Modified: 2022-05-16 08:50 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Atlan 2022-02-25 06:37:21 PST
We would be interested in a API like `console.screenshot` that would return an image object instead of displaying the image inaccessible on the console.

Our Safari Web Extension allows users to send HTML or CSS to Kaleidoscope, for a visual text comparison. With the current API we are able to send the HTML or computed CSS of an element via context menu action to Kaleidoscope. We also provide a javascript function, so developers can send any textual content to the app over the Web Inspector Console Command Line: 

> ksdiff($0.innerHTML)

It would be great if we could also provide image comparison in a similar manner like:

> ksdiff(inspector.screenshot($0))
Comment 1 Radar WebKit Bug Importer 2022-02-25 09:55:44 PST
<rdar://problem/89479439>
Comment 2 Sam Sneddon [:gsnedders] 2022-05-16 08:50:19 PDT
See also https://github.com/whatwg/console/issues/160 with regards to adding screenshot to the Console spec; we'd want to propose/discuss something like this there as well. One option would be to just make it return something like a blob URL and then auto-magically show that in the Console.