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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    3
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i nightmare-screenshoter

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • koshuang
  • glennfriend