shotty

0.1.18 • Public • Published

shotty

Take screenshots with a simple command line tool! It comes with phantomjs, chrome and firefox. If you want to use also safari webdriver, download the extension from here.

Getting started

Install imagemagick and graphicsmagick:

brew install imagemagick graphicsmagick

Install shotty globally:

npm install -g shotty

How to use it

shotty -h google.com apple.com -d ~/Desktop/screenshot

or

shotty -h localhost -p 8080 -d ~/Desktop/screenshot

nodeJS API

var Shotty = require('shotty');
var shotty = new Shotty();
 
shotty
  .addBrowsers(browsers)
  .addBreakpoints(breakpoints)
  .addWait(wait)
  .addUrls(urls)
  .addPort(port)
  .addFile(file)
  .addDest(dest)
  .noCrop(true)
  .run()
  ;

or

var Shotty = require('shotty');
 
var settings = {
  browsers: browsers,
  breakpoints: breakpoints,
  wait: wait,
  urls: urls,
  port: port,
  file: file,
  dest: dest,
  nocrop: true,
};
 
var shotty = new Shotty(settings).run();

CLI Options

version

Show version number

-v, --version

url

required
Set the url or urls. It's an array, just add the urls using spaces.
i.e. -u google.com apple.com

-u, --url

port

Set port number

-p, --port

file

Set file path

-f, --file

dest

Choose where to save the screenshots, default: "/tmp"

-d, --dest

browser

Set browser: chrome, firefox, safari, phantomjs, all. Default: "phantomjs"

-b, --browser

size

Set breakpoints, array. Default: ["320x480","768x1024","1200x800"]
i.e. -s 320x480 768x1024

-s, --size

wait

Waiting time before taking the screenshot, default: 0

-w, --wait

nocrop

Save the image without cropping the height (only PhantomJS/Firefox)

-n, --nocrop

help

Show help

-h, --help

Known issues

  • With Chrome and Safari is not possible to take a screenshot where the height is more than the screen resolution height
  • PhantomJS sometimes returns an empty image

Package Sidebar

Install

npm i shotty

Weekly Downloads

0

Version

0.1.18

License

MIT

Last publish

Collaborators

  • zelphir