How to save cookies?
CrazybutSolid opened this issue · comments
I'd like to save cookies after log in, so i don't have to log in again every time I launch the spider. Is it possible?
I tried using this gem:
https://github.com/kyamaguchi/capybara-sessionkeeper
but I can't make it work inside the spider
Hello @CrazybutSolid ! At the moment kimurai doesn't has a setting for that, but you can do this manually, or using gem https://github.com/kyamaguchi/capybara-sessionkeeper .
but I can't make it work inside the spider
So what the problem exactly?
When I try
require "capybara"
require "capybara/sessionkeeper"
session.save_cookies('user1.cookies.txt')
inside the simple spider
I get
NameError: undefined local variable or method `session' for #Kimurai::Base:0x00007fc2120cacc0
nevermind. changed "session" to "browser" and it did the trick