How to access cookies and session in Capybara 2.4.1
I am using 4 rails with the following gems:
- guard-rspec (4.3.1)
- rspec (3.0.0)
- rspec-core (3.0.3)
- rspec waits (3.0.3)
- rspec-mocks (3.0.3)
- rspec-rails (3.0.2)
- rspec-support (3.0.3)
- capybara (2.4.1)
- capybara-webkit (1.1.0)
Capybara works as expected in normal scripts / examples, but when I want to access a cookie or session, I get a NameError:
undefined local variable or method `session'
I have a custom class that I am using that stores cookie data and retrieves it to remember things about the user and then present certain things on the screen.
But I cannot get the tests to pass and I cannot view the cookie or session.
Do I need to mock? How can i do this?
+3
source to share
1 answer
Webkit provides cookies as follows:
page.driver.browser.manage.all_cookies
Link here: https://github.com/thoughtbot/capybara-webkit/issues/168
0
source to share