[Node.js] phantom Module's addCookie Method Arguments Changed
Tadashi Shigeoka · Tue, March 31, 2015
The arguments for the addCookie method in phantom, a PhantomJS wrapper for Node.js, changed from version 0.7.1 to 0.7.2.
As a result, code using the addCookie method stopped working due to errors.
phantom stdout: TypeError: incompatible type of argument(s) in call to addCookie(); candidates were
addCookie(QVariantMap)
phantom stdout: /u/apps/myapp/shared/node_modules/phantom/shim.js:5621
/u/apps/com/shared/node_modules/phantom/shim.js:4526
/u/apps/com/shared/node_modules/phantom/shim.js:4502
/u/apps/com/shared/node_modules/phantom/shim.js:4382
/u/apps/com/shared/node_modules/phantom/shim.js:4370
The change is:
addCookie: (name, value, domain, cb=->) ->
to
addCookie: (cookie, cb=->) ->
The arguments have simply changed.
So instead of passing name, value, domain as individual arguments, you need to modify the code calling the addCookie method to pass them bundled together as a cookie object.
- ph.addCookie's signature doesn't match the API docs · Issue #233 · sgentle/phantomjs-node
- Make ph.addCookie's signature match the PhantomJS API docs by pscollins · Pull Request #234 · sgentle/phantomjs-node
For details, reading the above issue and pull request will clarify that it was modified to align with PhantomJS API.
That’s all from the Gemba.