#35 ✓resolved
James B. Byrne

selects does not find input by field or label

Reported by James B. Byrne | November 13th, 2008 @ 03:28 PM

When calling webrat using:

When /^I select "(.)" from "(.)"$/ do |value, field| selects(value, :from => field) end

If one specifies a label value then this error results:

And I select "CORP" from "'Legal Form'"
   # features/step_definitions/webrat_steps.rb:16
  Could not find field labeled "'Legal Form'" (RuntimeError)
  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/flunk.rb:4:in

flunk'

  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/locators.rb:16:in

field_labeled'

  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/locators.rb:10:in

field'

  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/locators.rb:49:in

find_select_option'

  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/scope.rb:91:in

selects'

If one specifies the input field name instead then one gets this error:

And I select "CORP" from "entity_entity_legal_form" # features/step_definitions/webrat_steps.rb:16

  You have a nil object when you didn't expect it!
  The error occurred while evaluating nil.choose (NoMethodError)
  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/scope.rb:91:in

selects'

  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/rails.rb:88:in

send'

  /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/rails.rb:88:in

method_missing'

Comments and changes to this ticket

  • James B. Byrne

    James B. Byrne November 13th, 2008 @ 03:38 PM

    This is probably a duplicate of #28

  • James B. Byrne

    James B. Byrne November 13th, 2008 @ 03:53 PM

    I applied the patch from #29 and that changed the behaviour of this problem but did not eliminate it. The patched code now causes both find by name and find by label to report the same error:

    And I select "CORP" from "Legal Form"                      # features/step_definitions/webrat_steps.rb:16
      You have a nil object when you didn't expect it!
      The error occurred while evaluating nil.choose (NoMethodError)
      /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/core/scope.rb:91:in `selects'
      /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/rails.rb:88:in `send'
      /usr/lib/ruby/gems/1.8/gems/webrat-0.3.2/lib/webrat/rails.rb:88:in `method_missing'
    
    
  • James B. Byrne

    James B. Byrne November 14th, 2008 @ 03:42 PM

    Close this ticket please. Error is due to a fundamental misapprehension on my part. Webrat selects searches the form for the option_text (description) and not the option value. I did not discriminate between the two.

  • Bryan Helmkamp

    Bryan Helmkamp November 14th, 2008 @ 05:14 PM

    • State changed from “new” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Pages