SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.72k stars 8.19k forks source link

Add clipping information to GET /session/:sessionId/screenshot #646

Closed jeantil closed 9 years ago

jeantil commented 9 years ago

I mistakenly created this issue on the wrong tracker back in january.

This is an enhancement request for the JSON wire protocol.

Currently https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/screenshot doesn't take any parameter and doesn't document the expected relationship between the windows size and the screenshot size.

Ghostdriver in Phantomjs does not enforce clipping to viewport size when taking a screenshot, leading to screenshots which have the correct viewport width but a random height depending on page content.

PhantomJS does offer an API to define a clipping area to be used for rendering the screenshot but there is no way for Ghostdriver to use it without breaking a use case or another.

Adding a clip query parameter (or better a width and height) parameter to the GET screenshot call would allow both use cases (clipped and unclipped).

With the advent of FullPage websites/parallax/... the height of pages can be huge, leading to enormous screenshots. Adding viewport clipping would allow for smaller screenshots.

hopefully this is the correct tracker to submit this

Thanks

AutomatedTester commented 9 years ago

The default for when everything has moved to the W3C implementation of WebDriver is that screenshots will be limited to only the viewport and we are also adding the ability to screenshot specific elements 

— Sent from Mailbox

On Thu, Jun 11, 2015 at 9:01 AM, Jean Helou notifications@github.com wrote:

I mistakenly created this issue on the wrong tracker back in january. This is an enhancement request for the JSON wire protocol. Currently https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/screenshot doesn't take any parameter and doesn't document the expected relationship between the windows size and the screenshot size. Ghostdriver in Phantomjs does not enforce clipping to viewport size when taking a screenshot, leading to screenshots which have the correct viewport width but a random height depending on page content. PhantomJS does offer an API to define a clipping area to be used for rendering the screenshot but there is no way for Ghostdriver to use it without breaking a use case or another. Adding a clip query parameter (or better a width and height) parameter to the GET screenshot call would allow both use cases (clipped and unclipped). With the advent of FullPage websites/parallax/... the height of pages can be huge, leading to enormous screenshots. Adding viewport clipping would allow for smaller screenshots. hopefully this is the correct tracker to submit this

Thanks

Reply to this email directly or view it on GitHub: https://github.com/SeleniumHQ/selenium/issues/646

jeantil commented 9 years ago

that's great for my use case :) I guess I'll report this to phantomjs then (I noticed the ability of screenshotting specific elements in the w3c draft)

AutomatedTester commented 9 years ago

The specification in this area needs rewriting. Work has started in https://github.com/w3c/webdriver/pull/98

— Sent from Mailbox

On Thu, Jun 11, 2015 at 9:37 AM, Jean Helou notifications@github.com wrote:

that's great for my use case :) I guess I'll report this to phantomjs then (I noticed the ability of screenshotting specific elements in the w3c draft)

Reply to this email directly or view it on GitHub: https://github.com/SeleniumHQ/selenium/issues/646#issuecomment-111042833

lukeis commented 9 years ago

gonna close this issue, as the parts exist in other repos (either phantomjs&ghostdriver or w3c/webdriver )

jeantil commented 9 years ago

I have come to the same understanding. Thanks for closing the issue

Le mer. 17 juin 2015 22:58, Luke Inman-Semerau notifications@github.com a écrit :

gonna close this issue, as the parts exist in other repos (either phantomjs&ghostdriver or w3c/webdriver )

— Reply to this email directly or view it on GitHub https://github.com/SeleniumHQ/selenium/issues/646#issuecomment-112948186 .

foxx commented 9 years ago

Am I correct in saying that this issue will never be fixed? e.g. we will never be able to take full page screenshots?

lukeis commented 9 years ago

@foxx correct. It will take viewable page shots. As to say that which is in the current viewport.