Created
November 13, 2013 20:09
-
-
Save manuhabitela/7455526 to your computer and use it in GitHub Desktop.
basic casperjs conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var casper = require('casper').create({ | |
verbose: true, | |
logLevel: "debug", | |
viewportSize: { width: 1378, height: 768 }, //for real, my screen is like everyone else's! | |
pageSettings: { | |
loadImages: false, | |
loadPlugins: false, | |
//I'm using Chrome, I SWEAR | |
userAgent: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36" | |
}, | |
//don't load any external ressource | |
onResourceRequested: function(capser, requestData, networkRequest) { | |
if (requestData.url.indexOf("http://thetarget.com") !== 0) { | |
networkRequest.abort(); | |
} | |
} | |
}); | |
//logging all the thinnnngs | |
casper.on('page.error', function (msg, trace) { this.echo( 'Error: ' + msg, 'ERROR' ); }); | |
casper.on('remote.message', function(msg) { this.echo('Remote message: ' + msg); }); |
Oh, I missed that in the docs... thanks :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could also subscribe to the
resource.requested
event and abort from there: