I\'m trying to get cookie values in the Cucumber step:
Step definitions
When /^I log in$/ do
#
It seems that Selenium API has changed. The suggested solution did not work, but I after spending a bit of time looking around, I found a solution.
To save a cookie:
browser = Capybara.current_session.driver.browser.manage
browser.add_cookie :name => key, :value => val
To read a cookie:
browser = Capybara.current_session.driver.browser.manage
browser.cookie_named(key)[:value]
cookie_named returns an array consisting of "name" and "value", so we need an extra reference to extract cookie value.