Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Casperjs login: Does casperjs manage cookies?

I want my casper to log in and stay logged in during the session. Is it possible? If so, how?

like image 830
Euphe Avatar asked Jan 03 '14 14:01

Euphe


1 Answers

If you want to store cookies in CasperJS, you can use the PhantomJS cookiejar, which is accesible natively through CasperJS.

Simply add following option when you launch CasperJS:

--cookies-file=cookies.txt

Your cookies will be stored in that file. Even after exiting CasperJS, if you call CasperJS with this option, you'll have access to those cookies again.

Hope that helps.

like image 176
Thomas Avatar answered Sep 28 '22 03:09

Thomas