Reputation: 19803
My automatisation script required authorisation but the time for authorisation takes about 70% of the total time.
Can I authorised once in a month, then export session data in file and and every time after this import data about previous success session at the beginning of the script?
PS. If CaspersJS doesn't have support for this, can you advise similar framework with session mechanism on board?
Upvotes: 1
Views: 217
Reputation: 16838
To keep session at a remote site, specify a local file to store and read cookies from, like this:
casperjs --cookies-file=/tmp/mycookies.txt myscript.js
This is actually a command line argument that is then passed to Phantomjs (here's the full list, and you can use them all with Casperjs).
NB, if you're on Windows: in Casperjs versions pre 1.1 there was a bug causing such arguments to not be passed to Phantomjs, if you launched Casperjs via casperjs.bat file. The solution is to use the native casperjs.exe, available from version 1.1.DEV
Upvotes: 1