PhantomJS/CasperJS site login, cookies are not accepted by PhantomJS

前端 未结 2 1802
囚心锁ツ
囚心锁ツ 2021-02-03 10:55

I recently tried to login into a webiste that forces me to accept cookies. I\'m using phantomJs and casperJs. I wrote a little script that should handle the login, but it redire

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 11:24

    Maybe a bit later, but this is the answer:

    casper.userAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
    

    the cookies are failing because amazon doesn't like the default casper's user agent, in my case: "Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) CasperJS/1.0.2+Phantomjs/1.7.0 Safari/534.34"

提交回复
热议问题