-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Complete screenshot (no scroll) #328
Comments
^ +1 |
+1 |
You can ask Nightmare to get the dimensions of the body element (using An example might be useful: var Nightmare = require('nightmare'),
vo = require('vo');
function * run() {
var nightmare = new Nightmare({
show: false,
width: 1024,
height: 768
});
var dimensions = yield nightmare.goto('http://www.gmail.com')
.wait('body')
.evaluate(function() {
var body = document.querySelector('body');
return {
height: body.scrollHeight,
width:body.scrollWidth
}
});
console.dir(dimensions);
yield nightmare.viewport(dimensions.width, dimensions.height)
.wait(1000)
.screenshot(require('path')
.join(__dirname, 'gmail.png'));
yield nightmare.end();
}
vo(run)(function() {
console.log('done');
}); A couple of notes and questions:
|
thanks @rosshinkley for the example :-) |
Adding |
I've been playing around with the screenshot functionality but I couldn't make it print the whole content.
My use case is to compare the whole site snapshot for differences (similar to the phantomcss library). Casperjs allows to capture the whole scrollable screen in a png. Is there a way of doing the same with nightmare? If not, I'll see if it can be added easily but it may take some time as I just started getting into nightmare.
The text was updated successfully, but these errors were encountered: