I want to load a page using CapserJS, but how can I send cookie which was exported from chrome's http request header at that page?
Such as:
"SUB=_2AkMjHt3gf8NhqwJRmPkQzG_qZIp_yA3EiebDAHzsJxJTHmMJ7IUyLkMN2K7WzRJvm-Tv3YY0xyZo; SUBP=0033WrSXqPxfM72-Ws9jqgMF55529P9D9WhCT_2hbJ1W1Cc4xfF-mFPo;"
You could try to set the cookie headers directly like this:
There are multiple ways, but the easiest would be to use the
page.addCookie
orphantom.addCookie
functions which PhantomJS provides, but you would have to set the domain (and path). Keep in mind thatpage.addCookie
has to be done on a loaded page whereasphantom.addCookie
can be done before.