#255 awaiting-patch
Matthias Marschall

field_labeled method missing in selenium mode

Reported by Matthias Marschall | May 27th, 2009 @ 08:27 AM

Using field_labeled(field) is not available in selenium mode:

undefined method field_labeled' for #<Webrat::SeleniumSession:0x74ebd4c> (NoMethodError)

Comments and changes to this ticket

  • Matthias Marschall

    Matthias Marschall May 27th, 2009 @ 09:24 AM

    • Title changed from “field_labeled locator missing in selenium mode” to “field_labeled method missing in selenium mode”
  • gaffo

    gaffo May 28th, 2009 @ 07:16 PM

    • Tag changed from field_labeled, selenium to field_labeled, selenium, verify!
    • State changed from “new” to “awaiting-patch”

    I'm guessing this needs both a selenium session implementation and a JS finder as well?

  • Matthias Marschall

    Matthias Marschall May 29th, 2009 @ 06:16 AM

    Yes, both are needed. And I've not seen any example where selenium session is returning an Element (like field_labeled would have to do). So some implementation of an Element class for selenium is needed, too.

  • gaffo

    gaffo June 2nd, 2009 @ 02:54 PM

    Talked it over with brynary, yes we need to make a proxy object for selenium objects.

  • Spanners

    Spanners September 21st, 2009 @ 04:33 AM

    Hi All
    Has there been any progress with this patch or can anyone suggest a workaround? I'm trying to adjust our Cucumber tests to work with Selenium and this is really causing a problem.
    Thanks :)

  • Geoff Jacobsen

    Geoff Jacobsen December 13th, 2009 @ 04:00 PM

    @Spanners

    This might work:

     class Webrat::SeleniumSession
      def field_labeled(label, *field_types)
        Webrat::Locators::FieldLabeledLocator.new(self, Webrat::XML.document(response_body), label, *field_types).locate!
      end
    
      def current_dom
        @dom||=Webrat::XML.document(response_body)
      end
     end
    
  • dannyhawkins (at me)

    dannyhawkins (at me) January 12th, 2010 @ 11:52 AM

    I've fixed this in http://github.com/technophobia/webrat based on the fix by Geoff. Works a treat.

  • gaffo

    gaffo January 12th, 2010 @ 11:54 AM

    @dannyhawkins, do you have any tests showing that it now works?

  • gaffo

    gaffo January 12th, 2010 @ 11:55 AM

    • Tag changed from field_labeled, selenium, verify! to field_labeled, selenium, test!, verify!
  • alain57

    alain57 February 5th, 2010 @ 10:04 AM

    Hi, i'm using last gem version of cucumber, cucumber-rails as webrat and i still have this issue

    And the "domains_disney165.com" checkbox should be checked # features/step_definitions/web_steps.rb:236

      undefined method `field_labeled' for #<Webrat::SeleniumSession:0x7f21aa2ab9a8> (NoMethodError)
      (eval):2:in `field_labeled'
      ./features/step_definitions/web_steps.rb:238:in `/^the "([^\"]*)" checkbox should be checked$/'
      features/enhanced/domain/checkbox_search_save.feature:31:in `And the "domains_disney165.com" checkbox should be checked'
    

    Is the patch already included in webrat 0.7, or is it a bug with cucumber or cucumber-rails ?

    by the way, i needed to change the selenium-server.jar, because the default version does not support firefox 3.6
    i told the selenium firefox extentions in the jar, to accept firefox 4.0, so it will continue to work on 3.6 and even on 3.7 prealphas, maybe it would be nice to modify the selenium-server.jar in next version, so people can still continue test on firefox 3.6

  • Rob S.

    Rob S. August 31st, 2010 @ 02:26 PM

    • Milestone order changed from “0” to “0”

    @gaffo, @mattias

    The patch doesn't work, unless someone also addressed adding the Element proxy to Webrat::SeleniumSession.

    Still getting this error:

    Then the "Banner" checkbox should be checked # features/step_definitions/web_steps.rb:239

      undefined method `elements' for #<Webrat::SeleniumSession:0x1061cb3b0> (NoMethodError)
      /Users/robertslifka/.rvm/gems/ree-1.8.7-2010.02/gems/webrat-0.7.1/lib/webrat/core/elements/element.rb:13:in `load'
    

    A fix here would be very welcome, because it means that half of the steps defined in web_steps.rb that ship with Cucumber don't work (most use field_labeled).

    Thanks!

    Rob

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

Pages