nightmare-screenshoter

1.0.3 • Public • Published

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');
    }
  });
 

Readme

Keywords

Package Sidebar

Install

npm i nightmare-screenshoter

Weekly Downloads

3

Version

1.0.3

License

MIT

Last publish

Collaborators

  • koshuang
  • glennfriend