Posted over 11 years ago. Visible to the public.

Use the back button in Cucumber

In order to go back one page in your Cucumber tests, you can use the following step definition for Capybara:

When(/^I go back$/) do visit page.driver.request.env['HTTP_REFERER'] end

If you're on Webrat, this should work:

When(/^I go back$/) do visit request.env["HTTP_REFERER"]) end

An improved version of this step is now part of our gem spreewald on Github Archive .

Your development team has a full backlog of feature requests, chores and refactoring coupled with deadlines? We are familiar with that. With our "DevOps as a Service" offering, we support developer teams with infrastructure and operations expertise.

Owner of this card:

Thomas Eisenbarth
Last edit:
over 8 years ago
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Thomas Eisenbarth to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more