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 ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access