-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Screenshot domain/command #120
Comments
Yes, that looks reasonable to me. I think this should be pretty close to the existing WebDriver spec since there's nothing async happening, but obviously with a more CDPish flavour to the JSON data. Note that the minimum viable thing here probably only allows PNG and so doesn't have a quality parameter (but supporting JPEG probably isn't very hard, and it seems at least Puppeteer exposes that to users). One challenge is that the |
Yes, For the response, this is a place where having a binary WebSocket message and not having to encode it in JSON would reduce the size, but I don't think we should do that right away, or at least we should support JSON-only transport. |
For the WebDriver HTTP Full screenshots should work with Firefox these days, at least it was when I implemented the screenshot feature for CDP. But yes, that's just for Firefox and I don't know how other browsers behave. Something else we might want to take into account is the device scale factor, which would come in via a |
@whimboo for the device pixel ratio, I think that's something that should be possible to configure either when starting the session or per browsing context. In CDP, I think https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setPageScaleFactor is the command for it and I assume screenshots are then simply at the higher resolution. Or do you think it should be possible to downscale when taking a screenshot if the DPR is greater than 1? |
I think right now it's still https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride. From the perspective of automating screenshot generation it's annoying right now that I have to resize the screenshot afterward (including quality loss) to get it to the regular size. The relevant GFX related code in browsers should do that way better. Further it would also allow us to actually compare against reference images, which is currently not possible (not saying that this is always a good idea). |
It looks like Puppeteer uses For the downscaling, don't some image format have metadata for saying what the display size should be independent of pixel size? Might that be something to investigate, if the main problem is that they're too big when one manually looks at them? |
I cannot say, without having to dive into this more deeply. But right now I don't have the time for it. |
This got initially landed as
Support for the
Handled by #229
Handled by #383
Handled by #384 I think that it will be best to close this issue given that we have individual ones for the remaining different parameters. |
Prior art:
Something like a
screenshot.takeScreenshot
command with these parameters:context
: the browsing context idelement
: an element id (or a clip rectangle?)format
: PNG, JPEG, etc.quality
: Compression qualityfullPage
: Something like CDP'scaptureBeyondViewport
The text was updated successfully, but these errors were encountered: