我想通过session AUTH cookie登录到phantomJS的网站,我完成了它的代码,一切工作都很完美,问题是网站有另一个登录系统相同的cookie,一旦访问其他页面cookie将更新安全验证令牌,所以当我将第一个cookie添加到幻像时,我发现它设置为只读,因为我无法访问第二个登录系统内部的内容,因为网站正在尝试更新我手动添加的Cookie,但不幸的是,它因为Cookie设置为只读而失败。PhantomJS将Cookie设置为读写
代码我使用:
phantom.addCookie({
'name': 'some name here', /* required property */
'value': 'some hash here',
'domain': 'ea.some domain here.com', /* required property */
'path': '/',
'httponly': false,
'secure': false,
'expires': (new Date()).getTime() + (10000 * 60 * 60) /* <-- expires in 10 hour */
});
我以前试过我的脚本自动访问删除会话cookie,需要第二次验证,但它只是记录了我,因为我需要让我的旧的会话身份验证所以页面它可以使用新的会话authhash进行更新。
任何想法如何使手动添加的cookie一旦从服务器端请求更新?