I have a piece of PhantomJS code and I want to refactor it and move to CasperJS. However, in my original PhantomJS code, I have some lines of code directly operate on the page
object and I'm not sure how to translate them to CasperJS. Below is part of my original code.
var cookies = "C_B_A=2; tips=1;";
var page = require("webpage").create();
page.settings.userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36";
cookies.split(";").forEach(function(pair){
pair = pair.split("=");
phantom.addCookie({
"name": pair[0],
"value": pair[1],
"domain": ".mydomain.com"
});
});
I searched CasperJS documentation and there seems no cookie related methods. Here my question is, is there any way for me to reference the underling PhantomJS page
object and set its attributes?