nightmare-screenshot-selector
v1.0.2
Published
A Nightmare plugin to easily take screenshots.
Downloads
10
Maintainers
Readme
nightmare-screenshot-selector
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