Sofie/Philip - Thanks for your suggestions. I tried both the
approaches, but no luck.
HTML: <li>
<input id="current_client_id_3" name="current_client_id"
value="3" type="radio">
<label for="TestClientA"> TestClientA</label>
</li>
Corresponding haml(just in case)
%li
= radio_button_tag "current_client_id", client.id
%label{:for => client.client_name}=client.client_name
a) When I choose "current_client_id_3"
Error: cannot choose field, no radio button with id, name, or label
'current_client_id_3' found (Capybara::ElementNotFound)
./features/step_definitions/web_steps.rb:90
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:89:in `/^(?:|I )choose
"([^"]*)"(?: within "([^"]*)")?$/'
features\login.feature:16:in `And I choose "current_client_id_3"'
Got the same error with unmodified html code as well
b) When I choose "TestClientA"
Error:cannot choose field, no radio button with id, name, or label
'TestClientA' found (Capybara::ElementNotFound)
./features/step_definitions/web_steps.rb:90
./features/step_definitions/web_steps.rb:14:in `with_scope'
./features/step_definitions/web_steps.rb:89:in `/^(?:|I )choose
"([^"]*)"(?: within "([^"]*)")?$/'
features\login.feature:16:in `When I choose "TestClientA"'
Rails: 2.3.5, Ruby:ruby 1.8.7
On Dec 18, 12:35 pm, Philip Hallstrom <[email protected]> wrote:
> On Dec 17, 2010, at 6:19 PM, pingu wrote:
>
>
>
> > I am having a similar issue.
>
> > HTML:
> > <li>
> > <label> <input id="current_client_id_2"
> > name="current_client_id" value="2" type="radio">Test client 2
> > </label>
> > </li>
> > <li>
> > <label>
>
> > <input id="current_client_id_4" name="current_client_id"
> > value="4" type="radio">
> > Test client 2
> > </label>
> > </li>
> > <li>
> > <label>
> > <input id="current_client_id_3" name="current_client_id"
> > value="3" type="radio">
> > TestClientA
> > </label>
> > </li>
>
> Do what the other poster suggested or change your HTML to this...
>
> <input id="current_client_id_3" name="current_client_id" value="3"
> type="radio">
> <label for="current_client_id_3">TestClientA</label>
>
> Then your 'When I choose' should work.
>
>
>
> > Feature:
> > Scenario: home page
> > Given....
> > ..
> > When I choose "TestClientA"
> > .....
> > Then..
>
> > Step: I am using auto generated - choose in web_steps.rb
>
> > When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field,
> > selector|
> > with_scope(selector) do
> > choose(field)
> > end
> > end
>
> > This is not working either in default capybara driver or selenium
> > driver.
>
> > (::) failed steps (::)
>
> > cannot choose field, no radio button with id, name, or label
> > 'TestClientA' found (Capybara::ElementNotFound)
> > ./features/step_definitions/web_steps.rb:90
> > ./features/step_definitions/web_steps.rb:14:in `with_scope'
> > ./features/step_definitions/web_steps.rb:89:in `/^(?:|I )choose
> > "([^"]*)"(?: within "([^"]*)")?$/'
> > features\login.feature:17:in `When I choose "TestClientA"'
>
> > I tried xpath, but that is working only with selenium driver, not with
> > capybara default driver. Any ideas?
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.