nightmare-screenshot-selector

1.0.2 • Public • Published

nightmare-screenshot-selector

npm version NPM downloads Build Status Build Status JavaScript Style Guide

A Nightmare plugin. https://github.com/segmentio/nightmare

A Nightmare plugin to easily take screenshots.

Install

$ npm install --save nightmare-screenshot-selector

Usage

const Nightmare = require('nightmare');
const screenshotSelector = require('nightmare-screenshot-selector');
const fs = require('fs')
 
Nightmare.action('screenshotSelector', screenshotSelector)
 
var nightmare = Nightmare()
nightmare
        .goto('https://example.com/')
        .screenshotSelector('h1') // get the image in a buffer
        .then(function (data) {
          fs.writeFileSync('screen.png', data)
        })
        
nightmare
        .goto('https://example.com/')
        .screenshotSelector({selector: 'h1', path:'screen.png'}) // create directly a file
        .end()

Test

You just have to clone the repo and run

$ npm test

License

MIT © Léo Lozach

Package Sidebar

Install

npm i nightmare-screenshot-selector

Weekly Downloads

10

Version

1.0.2

License

MIT

Last publish

Collaborators

  • leelow