Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement screenshots #217

Merged
merged 1 commit into from
Sep 13, 2015
Merged

implement screenshots #217

merged 1 commit into from
Sep 13, 2015

Conversation

matthewmueller
Copy link
Contributor

fixed up the nightmare.screenshot(path) implementation. Basically passes the image buffer back from the electron process to the node process to write the file.

Here's an example:

var Nightmare = require('./')

Nightmare()
  .goto('https://google.com')
  .screenshot('screenshot.png')
  .end(function(err) {
    if (err) throw err
  })

@reinpk
Copy link
Contributor

reinpk commented Sep 13, 2015

bloody beautiful :)

reinpk added a commit that referenced this pull request Sep 13, 2015
@reinpk reinpk merged commit 90f3b4a into v2 Sep 13, 2015
@reinpk reinpk deleted the implement-screenshots branch September 13, 2015 03:32
fs.writeFile(path, img, function (err) {
parent.emit('screenshot', arguments);
});
parent.emit('screenshot', img.toPng())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can probably encode differently if it's .jpg vs .png

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, hmmm let's just document "only png" in the readme for now and see if it's an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants