node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »




See sharp's instructions for installing libvips. Sharp is used to resize screenshots and turn them into JPEG, PNG or WebP images.

After that a simple npm install grabber should do the trick. ChromeDriver is straight-forward to install via npm install, but if you want to use Firefox to take screenshots you'll have to be running Selenium server.

Try out some of these guides for getting Xvfb and Selenium running so that you can take "headless" screenshots in a Linux environment. You probably don't want to be screenshotting in OSX or Windows or a real (non-framebuffer) X server because the browser window is going to pop up.


Both Firefox and Chrome seem to have the limitation that you can't resize the browser window to be larger than the screen, so you're limited by your screen dimensions. In Linux you can probably get around this to some extent using Xvfb.

Chrome cannot take a screenshot of the full page and will only screenshot the visible portion. Firefox can screenshot the entire page, but this library doesn't allow for that just yet.


grabber = require 'grabber'
chromeOptions =
  hostname: ""
  port: 9515
  pathname: "/wd/hub"
  args: [
    "--port=" + 9515
browser =, browser) ->
  return console.error(err) if err
  screenshotOptions =
    url: ''
    width: 1024
    height: 768
    resize: 512
    quality: 80
    # see browser.waitForConditionInBrowser in wd 
    condition: "document.querySelectorAll('.foo').length > 0"
    # see wd for documentation on browser 
    cleanup: (browser, cb) ->
      # Do something with browser like dismiss popups or scroll down to the 
      # button of the page or whatever you want to do before you take a 
      # screenshot. 
      cb() # remember to call cb() when you're done 
    # save the file 
    out: 'google.jpg'
  grabber.commands.screenshot browserscreenshotOptions(err, image) ->
    return console.error(err) if err
    # image now contains an instance of a sharp image object thing that you can 
    # then do something with if you want. Probably not necesary if you passed 
    # in an out parameter 


Most of the action happens in the examples/ directory. and are command-line utilities to take screenshots.

The parameters are url, width, height, resize, quality, crop. The CLI utilities also take an --out=filename.(png|jpeg|webp) parameter and support a -t parameter for testing with Thing's settings.