Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8776065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:57:39+00:00 2026-06-13T18:57:39+00:00

I was trying Capybara for the first time and having trouble with it finding

  • 0

I was trying Capybara for the first time and having trouble with it finding my form. I’m using Rspec, Capybara, Rails 3.2.8, and Twitter Bootstrap.

In my test, I had:

before do
  choose  "Residential"
  choose  "Storage"
  fill_in "Customer Location",  with: 30082
  fill_in "datepicker",         with: 2012-12-02
  fill_in "Email",              with: "jesse@test.com"
  fill_in "Phone",              with: "555-555-5555"
 end

And was getting the error:

Failure/Error: choose  "Residential"
   Capybara::ElementNotFound:
     cannot choose field, no radio button with id, name, or label 'Residential' found

In my form, I had (excerpt):

    <%= quote.radio_button :customer_type, "Residential"%>
    <%= quote.label "Residential", class:"radio inline" %>

When I fired up the server, I could see the form and Firebug showed that I had a label named “Residential” associated with the form element.

After searching for the problem and finding this post: Capybara not finding form elements (among others), I couldn’t figure out why it wasn’t working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:57:41+00:00Added an answer on June 13, 2026 at 6:57 pm

    I ultimately went back to Capybara’s Rubydocs ( http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Actions ) and found the section on the “Choose” method.

    I didn’t dive deep into the documentation, but I saw that it was looking for a “locator” in the :radio_button and so tried associating one directly.

    I thus changed my form to (notice I added “id” to the form element):

        <%= quote.radio_button :customer_type, "Residential", id:"Residential"%>
        <%= quote.label "Residential", class:"radio inline" %>
    

    and that portion of the test passed! I repeated with each of my form elements and everything performed as expected.

    Hope this is useful to someone else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to test a presenter method using a Capybara RSpec matcher. Lets say
I'm trying to use capybara with rspec to test my rails app. I've simplified
I'm writing an integration test for a rails application using Capybara within Rspec. After
Using Rails 3.0.5, RSpec 2 and Capybara 0.4.1.2 and I'am trying to write a
I am trying to test a sinatra app using minitest and capybara but get
I'm trying to implement a request spec using Capybara, RSpec and JS (using Webkit).
I'm having a lot of trouble running my cuke test cases that use capybara-webkit
I'm trying to test the authenticate_or_request_with_http_basic method using Cucumber and Capybara, but it doesn't
I am using Cucumber / Capybara with Rails 3 and am trying to validate
I'm trying to get Capybara to work with rails 3 (and test unit) but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.