Reputation: 11
The casperjs captures a part of window. it happens when I make screenshot while testing in casperj. I use
this.capture('google.png', {
top: 0,
left: 0,
width: 1280,
height: 960
});
I also tried use
this.capture('google.png');
and
this.captureSelector('weather.png', '#body');
How can I make a screenshot of the whole window (document) ?
Upvotes: 1
Views: 435
Reputation: 1116
This works for me, try setting a viewport
:
var casper = require('casper').create ({
waitTimeout: 15000,
stepTimeout: 15000,
verbose: true,
viewportSize: {
width: 1280,
height: 960
},
pageSettings: {
"userAgent": 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.10 (KHTML, like Gecko) Chrome/23.0.1262.0 Safari/537.10',
"webSecurityEnabled": false,
"ignoreSslErrors": true
},
onWaitTimeout: function() {
// casper.capture('./out/wait-timeout:_' + TimeTidy() + '.png');
// throw new Error stuff;
},
onStepTimeout: function() {
// casper.capture('./out/step-timeout' + TimeTidy() + '.png');
// throw new Error stuff;
}
});
And then use:
casper.capture('google.png');
// or if within casper block:
// this.capture('google.png');
Upvotes: 1