Created
July 17, 2012 13:58
-
-
Save thom4parisot/3129526 to your computer and use it in GitHub Desktop.
Dump Response Headers with CasperJS
This file contains hidden or 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(); | |
casper.start(); | |
casper.open('http://borisschapira.com/'); | |
casper.then(function dumpHeaders(){ | |
this.currentResponse.headers.forEach(function(header){ | |
console.log(header.name +': '+ header.value); | |
}); | |
}); | |
casper.run(function(){ | |
this.exit(); | |
}); |
I am using phantom js as well as caspersj. I am trying to do it like this to display the cookies:
var url = 'https://google.com';
casper.thenOpen(Url, function() {
var cookies = page.cookies;
console.log('Listing cookies:');
for(var i in cookies) {
console.log(cookies[i].name + '=' + cookies[i].value);
};
)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice to know, thank you.
Here's another one for look up what is in the cookies of current session: