selenium-shutterbug
selenium-shutterbug copied to clipboard
ShootElement: for scrollable `div` within `iframe`, scrolls element but screenshot is incorrect
Use this fiddle to confirm.
My unit test activates the result iframe and then uses shootElement for #VerticallyScrollableDiv.
Here is the result:

Currently shutterbug supports screenshots of scrollable frames and elements (as per snippets below) but not the elements in the frames. Leaving in the backlog for future enchancement.
Frame screenshots
- Take screenshot of scrollable frame locatable by supplied
frameID:
Shutterbug.shootFrame(driver, "frameID", CaptureElement.FULL_SCROLL).save();
- Take screenshot of scrollable frame web element:
Shutterbug.shootFrame(driver, frameWebElement, CaptureElement.FULL_SCROLL).save();
Please note that currently full scrollable frame screenshot is only possible when the full frame is visible in the viewport. If frame size is greater than viewport size UnsupportedOperationException will be throws suggesting to use CaptureElement.VIEWPORT instead.
Scrollable WebElements screenshots
- Take screenshot of scrollable web element. Horizontal capture only:
Shutterbug.shootElement(driver, webElement, CaptureElement.HORIZONTAL_SCROLL).save();