[rspec-users] issues when trying to select an option in a drop down list

S Ahmed sahmed1020 at gmail.com
Thu Mar 1 05:04:00 UTC 2012


My html looks like:

<select id="account_car_type" name="account[car_type]"><option value="6
">Acura</option> <option value="7">Honda</option> <option value="8">Ford
</option> <option value="9">Toyota</option> <option value="10">GM</option>
</select>
My requests spec looks like:

before do
  select '7', :from => "account[car_type]"
  fill_in ..
  ..

end

I get the error message:

 Failure/Error: select '7', :from => "account[car_type]"
     Capybara::ElementNotFound:
       cannot select option, no option with text '7' in select box
'account[car_type]'
     # (eval):2:in `select'
     # ./spec/requests/account_pages_spec.rb:13:in `block (4 levels) in
<top (required)>'


I also tried:

select 'Honda', :from => "account[car_type]"

And got the same type of error.

What am I doing wrong here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120301/c6d64312/attachment.html>


More information about the rspec-users mailing list