I only need screenshots of the current viewport, particularly respecting the scroll position. Basically what the current Chrome driver does.
From what I\'ve read it seem
This is a frequently changing issue..
AFAIK right now Chrome- and IEDriver both capture screenshots of the viewport only, while FFDriver captures a full-page screenshot (FF will change this in the future). See also my answer to this question.
There are two competing definitions of "screenshot" when dealing with WebDriver. The first is the definition used by the open-source project, where a screenshot is defined to be an image of the entire DOM of the loaded page. In this case, both the IE driver and the Firefox driver are doing the correct thing as defined by the project since 2010. The Chrome implementation of WebDriver is incorrect in returning an image of only the visible view port.
The W3C WebDriver specification, on the other hand, defines screenshots to be of the current view port only. This is at odds with the current open-source project's driver implementations (IE and Firefox), and can be expected to change in the future. Once the specification has attained "Candidate Recommendation" status, those drivers are likely to be updated.
As an aside, it should be noted that the IE driver in no way uses a "scroll-and-stitch" method to create its screenshots. It does resize the browser window large enough to display the entire DOM, as calculated at the moment the screenshot is requested, and take an image of that. However, please note that there are issues with IE 10 and 11 in producing these full-DOM screenshots depending on the bit-ness of your operating system and of the IEDriverServer
executable you're using.
At present, you'll need to use a tool external to WebDriver to obtain view-port-only screenshots for IE and Firefox.