O'Reilly logo

The Cucumber Book, 2nd Edition by Steve Tooke, Aslak Hellesoy, Matt Wynne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Capybara API

Even though we have used only four of Capybara’s methods at this point, we have actually explored the most essential parts already. Let’s take a look at more of Capybara’s API.

The methods in the Capybara API can be grouped in six categories: navigating, clicking links and buttons, interacting with forms, querying, finding, and scoping. The following sections list the most common methods. Make sure you consult Capybara’s own documentation for more comprehensive details.

Navigating

visit(path)

Navigates to the page at path, issuing a GET request.

Clicking Links and Buttons

click_link(locator)

Finds a link by ID or text and clicks it. This may cause Capybara to load a new page.

click_button(locator)

Finds a button ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required