Skip to content

PhantomJS Capture Script

Scott Behrens edited this page Jul 30, 2014 · 1 revision

Located within the sketch/assets/capture.js file, is the PhantomJS script that provides screenshots and html capturing for a provided URL.

Customizing the PhantomJS Capture script

There are four key areas which may warrant customization and they are enumerated below:

var defaultOpts = {
    ajaxTimeout: 400,
    maxTimeout: 800
};

ajaxTimeout - Increase this value if Ajax heavy web applications are not fully loaded when screenshots are created.

maxTimeout - Increase this value if resource heavy web applications are not fully loaded when screenshots are created.

You can also make changes to the default size of the requests (which is 1280,800):

var width = args[3] || 1280;
var height = args[4] || 800;