W3C implementation of getscreenshot (used by Selenium WebDriver) renders incorrectly for elements with position fixed.




6 years ago
5 years ago


(Reporter: shexman, Unassigned)


18 Branch
Windows 7

Firefox Tracking Flags

(Not tracked)




6 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0 (Beta/Release)
Build ID: 20130116073211

Steps to reproduce:

Assuming reader is familiar with Selenium WebDriver (Test Automation Framework).
1. Start a FirefoxDriver.
2. Load Soasta's demo page: http://www.soasta.com/cloudtest/demos/
3. Save the screenshot.

Actual results:

The footer is rendered at the middle of the screen.
Firefox's screenshot: http://i.imgur.com/CR6NtTG.png

Expected results:

The footer should be rendered at the bottom of the screen.
Chrome screenshot: http://i.imgur.com/tuj8d1P.png

The implementation of the API that Firefox exposes (to add-ons developers) for taking screenshots, and to Selenium, which is also a W3C standard proposal (http://www.w3.org/TR/webdriver/#screenshots) has a rendering bug for elements with fixed positioning:
Firefox: http://i.imgur.com/CR6NtTG.png
Chrome: http://i.imgur.com/tuj8d1P.png

Elements with position Fixed (footer in our case) are not positioned as the standard states, Firefox renders them according to a viewport with dimensions similar to the screen's, and not an infinite one like Chrome/IE do (Quoting from the spec: "One way to think of capturing the entire DOM is that the user has an infinitely large monitor and has resized the window to allow all content to be visible").

I've opened a bug in the Selenium bug tracker first, which claim (rightfully) that this is not a Selenium bug.

Thanks in advance,
Oren Rubin

p.s. I've opened a Firefox feedback ticket first. Apologies for the cross posting.
Unfortunately the current FirefoxDriver is not maintained by Mozilla, when Marionette is out for public consumption then please raise bugs here.
Last Resolved: 6 years ago
Resolution: --- → INVALID

Comment 2

6 years ago
Hi David,

My assumption was based on that Firefox itself is probably rendering and taking the screenshot itself, and exposing it through some API.
To verify my assumption, I've downloaded a Firefox add-on (http://getfireshot.com) which uses the same API, and as I suspected, the image is flawed as well: http://imgur.com/1jaZtm2

Oren Rubin
the "API" is the canvas API. We just take the DOM and push it into there and then ask canvas to return as a base64 image from the canvas.

We dont have a specific API for this that people can use.

Comment 4

6 years ago
The question is whether you change the viewport to the document's size? from the W3C spec: "the user has an infinitely large monitor and has resized the window to allow all content to be visible".

Doesn't it look weird to you that the footer (with the style "bottom:0") is in the middle of the screenshot? I hope you agree with me that Chrome's screenshot is more logical.


5 years ago
Resolution: INVALID → ---

Comment 5

5 years ago
The only hack I could find (without opening the source code) is rotating the body i.e. "-moz-transform: rotate(0deg)".
This will make all fixed positioned elements(*) behave as absolute.

Note that this solution has sever side effects, and I still yearn a real (side effects free) fix.

(*) http://meyerweb.com/eric/thoughts/2011/09/12/un-fixing-fixed-elements-with-css-transforms/
Since this is for Selenium WebDriver and not Marionette and we are just using Canvas to render the DOM this needs to be handled on the WebDriver project
Last Resolved: 6 years ago5 years ago
Resolution: --- → FIXED
Resolution: FIXED → WONTFIX
You need to log in before you can comment on or make changes to this bug.