#266 new
Pelle Braendgaard

Selenium version of has_selector and has_tag are incomplete

Reported by Pelle Braendgaard | June 20th, 2009 @ 10:30 AM

have_selector for selenium doesn't support content and the have_tag is not complete

I've implemented these as good as I can and they seem to work. At least a lot more of our cucumber steps now pass in selenium.

Here is the commit:

http://github.com/pelle/webrat/commit/06a37a2d50e8f115f74024b034b9d...

Comments and changes to this ticket

  • Pelle Braendgaard

    Pelle Braendgaard August 14th, 2009 @ 01:23 PM

    • Assigned user set to “Bryan Helmkamp”

    Any chance of getting this in? The Selenium selectors are broken.

  • Emmanuel Nicolau
  • Jesper Rønn-Jensen

    Jesper Rønn-Jensen August 26th, 2009 @ 05:07 AM

    +1 for this (although i have not tried it out)

    Pelle, is it necessary to add any test that confirms your fix is working?

    Also, Bryan recently moved files around. Try to see if your fix is still working with most recent code.

    (that can probably make it easier for him to decide to pull :)

    /Jesper Rønn-Jensen

  • Pelle Braendgaard

    Pelle Braendgaard August 26th, 2009 @ 10:15 AM

    Just rebased it ontop of brynary's changes. There weren't actually any changes in that area, so it looks like it's still broke.

    The problem is that the matchers are different between regular webrat and selenium. This makes it very difficult if you are doing any kind of detailed testing that you want to occasionally run on selenium.

  • Pelle Braendgaard
  • Karl

    Karl September 10th, 2009 @ 10:01 AM

    I get the following error when i applied the patch to the latest webrat.

    Then I should see a feed entry for each online order confirmation # features/step_definitions/all/weshop_steps.rb:285

      can't convert nil into String (TypeError)
      /Users/karl/NetBeansProjects/weshopnetwork/vendor/plugins/webrat/lib/webrat/selenium/matchers/have_selector.rb:32:in `+'
      /Users/karl/NetBeansProjects/weshopnetwork/vendor/plugins/webrat/lib/webrat/selenium/matchers/have_selector.rb:32:in `selector'
      /Users/karl/NetBeansProjects/weshopnetwork/vendor/plugins/webrat/lib/webrat/selenium/matchers/have_selector.rb:24:in `matches?'
      /Users/karl/NetBeansProjects/weshopnetwork/vendor/plugins/webrat/lib/webrat/selenium/selenium_session.rb:155:in `wait_for'
      /Users/karl/NetBeansProjects/weshopnetwork/vendor/plugins/webrat/lib/webrat/selenium/matchers/have_selector.rb:13:in `matches?'
      /usr/local/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/expectations/handler.rb:11:in `handle_matcher'
      /usr/local/lib/ruby/gems/1.8/gems/rspec-1.2.8/lib/spec/expectations/extensions/kernel.rb:27:in `should'
      ./features/step_definitions/all/weshop_steps.rb:287`
    

    It happened with this have_selector invocation:


    response.should have_selector("#news-feed")

    I was able to get around it by changing:


    {mkd-extraction-1c215d319252287fa6745d4d4ea494aa}

    To:


    {mkd-extraction-f9c9ccf5a144171ec0e2d359aee6a3c7}
  • Karl

    Karl September 10th, 2009 @ 10:04 AM

    For some reason, my formatting didn't come out properly above. Trying again.

        `def selector
          "css=#{@expected}" + ((@content && ":contains('#{@content}')") || '')
        end`
    
  • nbenes

    nbenes November 3rd, 2009 @ 12:50 PM

    Would be really nice to get this fix in - It doesn't even accept a block for sub-selectors? >.<

    So +1

  • Rob Aldred

    Rob Aldred November 4th, 2009 @ 11:12 AM

    response.should have_tag('form#form_id' do
      with_tag('.field')
    end
    

    like with webrat core would be perfect

    +1

  • Steven Hansen

    Steven Hansen February 12th, 2010 @ 02:49 PM

    Another +1 on adding Pelle's fix.

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