I need to take a screenshot of a whole web page.
I have seen How can I take a full page screenshot of a webpage from the command line? where many ways to take a screenshot are proposed but I need to use firefox for a better effect.
I need to take a screenshot of a whole web page.
I have seen How can I take a full page screenshot of a webpage from the command line? where many ways to take a screenshot are proposed but I need to use firefox for a better effect.
To make screenshots of web pages showing the whole scrollable area of the page in firefox, I propose two separate ways.
Both save an image of the page that shows all parts or the web page that you could reach by scrolling down (and right/left) - think all view positions stitched together;
For long pages, the image can easily be several thousand pixel high.
The "professional" way - using a web browser GUI-level testing and automation tool:
The automation tool Selenium - usually used for UI testing - can do full page screen shots;
It seems to be some overhead to set it up just for that task, though.
For example:
See so.SE: Screenshots using Selenium IDE Firefox plugin
To install the firefox part of Selenium, get the firefox add-on - but not from the official add-ons page - it's on the download page of Selenium as an xpi file. This is the current version.
(There are lots of add-ons for extending selenium itself (but in the technical for of a firefox add-on), all called "Selenium ..." or even "Selenium IDE ..." on the Add-ons website - very confusing.)
The "hackish" way - using internal firefox commands by keyboard automation:
There is an internal command prompt in firefox, kind of a development tool, which, as @Fireflight pointed out, has a command to make screenshots. But, as far as I know, that can not controlled from the command shell line normally. But what we can do, is to simulate key presses to make use of it.
We need to choose a browser window, open the prompt, enter the firefox internal command (using a file name based on current date and time), run the command, and close the prompt again:
The command line utility
xdotool
can interact with X windows on the level of X11 events. We use it to choose the firefox window that shows the page, and to send the right key strokes to make the screenshot.(This is a somewhat brittle approach: it's depending on keyboard timing, it will not work if the prompt is already opened, or contains text (To open or close it, press Shift-F2) - but if it works, it's really nice.)
As an example how this kind of screenshot looks, here's an example of
man xdotool
on manpages.ubuntu.com, scaled down to 20% (original 1336x15653), done with thexdotool
solution:In Firefox you can hit
Shift-F2
, then in the command line that appears, just type:There are several more commands and options available as well.
You can take a video from your firefox. Use a command like:
You will likely need to modify the size (1024x768) and position ( :0.0+10,20 ) to suit your needs.
Once you have the video you can convert it to a bunch of .png files with mplayer:
Then select the best image for your needs.