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