Capturing web pages screenshots from command line

The solution is based on using http://phantomjs.org/. Build and setup instructions are available on the project's website.

It supposed to work with most of web pages, which could also have dynamically loaded contents (scripts are tracking asynchronous requests/responses as well).

Code could be taken from Dashboard's git:

This directory contains following items:

  • lib : common code and libraries for the scripts
  • screenshot.js : capturing a screenshot of an arbitrary webpage
  • sam3-grid.js : capturing a sceenshot of result table from SAM3 pages

Usage:

./phantomjs screenshot.js URL OUTPUT_FILE [PAGE_SETTINGS]

Supported output formats: png, gif, jpeg, pdf (deciding on file extension). Default format: png

Details on webpage's PAGE_SETTINGS could be found here: http://phantomjs.org/api/webpage/

Default settings:

{"settings":{"resourceTimeout":10000},"viewportSize":{"width":800,"height":600}}

-- SergeyBelov - 2015-10-16

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2015-10-16 - SergeyBelov
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    ArdaGrid All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback