SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

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

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 8384

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 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.

Thanks

Reported by jean.helou on 2015-01-14 17:35:33

lukeis commented 8 years ago

Reported by jmleyba on 2015-01-15 03:31:34

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 17:47:30

lukeis commented 8 years ago

bug is with phantomjs / ghostdriver where it should run only 'visible' viewport, I would recommend if a driver.window.set_size is called, that ghostdriver clips accordingly (otherwise full viewport?). This bug should be logged with that project.