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.

  • 4
    i think you can't do this without using more than one programm. first firefox has no built in screencapture nor webpage capture abillities second you can't tell firefox to use a plugin/add-on from command line. so you probably neeed to do a combination of a tool to download the source using a souce to picture tool which you can tell to use a special rendering engine and tell it to use firefox's engine gecko. the problem is the part from source to picture you have to code your self i don't think such a tool exists.
    – konqui
    Commented Jul 2, 2014 at 6:36

3 Answers 3


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:

Command: open; Target: http://www.google.com
Command: captureEntirePageScreenshotAndWait; Target: \\Screenshots\\test.png

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:

FF=$(xdotool selectwindow)
xdotool key --window $FF Shift+F2 sleep 1
xdotool type --window $FF --delay 50 "screenshot page-$(date +%Y%m%d-%H%M%S).png --fullpage "
xdotool key --window $FF Return sleep 0.5 key --window $FF Shift+F2

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 the xdotool solution:

full page screenshot of man xdotool at 20% scale, edited to half hight

  • 1
    It's seems a good way, I will try it ! Edit : The problem is it start a new window of firefox !
    – Nymeria
    Commented Jul 2, 2014 at 7:13

In Firefox you can hit Shift-F2, then in the command line that appears, just type:

screenshot filename.png --fullpage

There are several more commands and options available as well.

  • is it possible to do this with command line ?
    – Nymeria
    Commented Jul 9, 2014 at 5:38
  • I don't believe so. At least, I never saw any mention of that in their documentation
    – Fireflight
    Commented Jul 11, 2014 at 20:56

You can take a video from your firefox. Use a command like:

mkdir ~/my_video
cd ~/my_video
avconv  -an  -f x11grab -r 30 -s 1024x768 -i :0.0+10,20  -vcodec libx264  -preset ultrafast -threads 0 video.mkv

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:

mplayer video.mkv -vo png

Then select the best image for your needs.

  • I think the point was to have the whole web page on the screen shot - not just the first window. Seems this solution does not do that? Commented Jul 2, 2014 at 7:08
  • And this is related to firefox how? Browser is of no concern here :)
    – Rinzwind
    Commented Jul 2, 2014 at 7:46
  • Nymeria needs a screenshot of a web page. I have provided a way to get one. Yes, that solution will work with any program, not just firefox. Moreover if the web page is javascript-heavy and updates itself he/she will be able to pick the best screenshot, unlike the selenium solution.
    – sмurf
    Commented Jul 2, 2014 at 11:56

Not the answer you're looking for? Browse other questions tagged .