nightmare-screenshoter
v1.0.3
Published
Nightmare plugin for improved screenshot
Downloads
5
Readme
nightmare-screenshoter
Extend Nightmare to improve screenshot with selector.
.screenshotSelector(path, selector)
Saves a screenshot of the element which matches the specified selector to the specified path.
Example
const Nightmare = require('nightmare');
const installPlugin = require('nightmare-screenshoter').installPlugin;
installPlugin(Nightmare);
const screenshotPath = path.join(process.cwd(), 'test.png');
new Nightmare()
.goto('http://example.com')
.screenshotSelector('test.png', 'h1')
.then(() => {
const stats = fs.statSync(screenshotPath);
if (stats.isFile()) {
console.log('DONE');
}
});