phantomjs/main.js
function(option) {
  var opt = {
    name: option.name || Date.now().toString(),
    path: option.path ? option.path + '/' : '',
    rect: option.rect || webpage.viewportSize
  };

  // use clipRect to capture only the area of the specified position
  webpage.clipRect = opt.rect;

  webpage.render([options.screenshotPath, opt.path, opt.name, '.png'].join(''), {format: 'png'});
  return option;
}
function(option) {
  var opt = {
    name: option.name || Date.now().toString(),
    path: option.path ? option.path + '/' : '',
    rect: option.rect || webpage.viewportSize
  };

  // use clipRect to capture only the area of the specified position
  webpage.clipRect = opt.rect;

  webpage.render([options.screenshotPath, opt.path, opt.name, '.png'].join(''), {format: 'png'});
  return option;
}
function ( option ) { var opt = { name : option . name || Date . now ( ) . toString ( ) , path : option . path ? option . path + '/' : '' , rect : option . rect || webpage . viewportSize } ; // use clipRect to capture only the area of the specified position webpage . clipRect = opt . rect ; webpage . render ( [ options . screenshotPath , opt . path , opt . name , '.png' ] . join ( '' ) , { format : 'png' } ) ; return option ; }
Take screenshot of current page
Take screenshot of current page