mocha-phantomjs-core icon indicating copy to clipboard operation
mocha-phantomjs-core copied to clipboard

issues with phantomjs 2 and cookies

Open nathanboktae opened this issue 10 years ago • 2 comments

  • --cookies-file is currently broken - see ariya/phantomjs#13115
  • cookies are now per-page via page.cookieJar, but page.addCookie still exists - does it just proxy to the other call?

Before we had a test that was adding a cookie without a doman, loading the tests on the file: protocol, and it saw the cookie there. Now in phantomjs2, that cookie fails to add because it has no domain. Also, that test didn't make much sense in the real world. Cookies always are tied to a domain, but file: has always been special in the same origin policy, not really having a domain, so the test wasn't very accurate to begin with.

In my manual tests, I wasn't able to add a cookie before loading a page with a domain at all.... :/

Help wanted with this one.

nathanboktae avatar May 14 '15 05:05 nathanboktae

How does someone add cookie per page, because in documentation I only see addCookie, and it adds it to phantom?

MaestroJurko avatar Jan 04 '16 16:01 MaestroJurko

Phantomjs 1 didn't support this so mocha-phantomjs didn't support it explicitly. However if you use a before hook, you could use the API to set the cookies as you wish.

nathanboktae avatar Jan 04 '16 17:01 nathanboktae