Feature Request: Add Cookie to page request.
jozzhart opened this issue · comments
I'd put a pull reuest in, but I can't get it to work.
https://github.com/ariya/phantomjs/wiki/API-Reference#appendix
I added the following to render.js.
var page = require('webpage').create();
page.addCookie({
'domain':'localhost',
'name': 'connect.sid',
'value': 's:ePzRBZk5KjCRhHV-UrCSHrGv.uz0aLkqm/9DaO/uMlXt6j8D89/5GTW19caz/wE/DHjU'
});
if (phantom.args.length < 2) {
console.log('11');
console.log('incorrect args');
phantom.exit();
I checked the request headers on the server, and the cookie simply isn't being added. I'm not sure if you have any suggestions.
Thanks for your time,
Jozz
Ah, cookies never crossed my mind but I can see the value would be huge. In their docs it looks like you have to set phantom.cookiesEnabled = true;
. Is the expires
key required?
From the docs, only name, value, domain are required.
Ok, I can take a look at it, I suppose it would be nice to be able to pass in an array of cookies from the options object also.