#236 ✓duplicate
Josh Clayton

click_button doesn't click the button element in Selenium mode

Reported by Josh Clayton | April 29th, 2009 @ 10:43 AM

It looks like the button.js locator only looks for input[type=submit|image]. It seems like it would also match if a button[type=submit] is on the page.

Comments and changes to this ticket

  • ncancelliere

    ncancelliere May 6th, 2009 @ 05:01 PM

    Yes, this is a problem. I am using jQuery (specifically their dialog boxes with the buttons) and Webrat isn't finding them because of the same issue. jQuery uses button and not input elements.

  • gaffo

    gaffo May 10th, 2009 @ 10:35 PM

    • Tag changed from click_button, enhancement, featurerequest, selenium to click_button, enhancement, featurerequest, selenium, stale, verify

    Josh/ncancelliere, It would help quite a bit if you could include some broken and working html and test code. As it is I'm not really sure what the specific issue is or how to test for it. Thanks for the input!

  • Josh Clayton

    Josh Clayton May 11th, 2009 @ 07:06 AM

    Within the view:

    
    <!-- new.erb -->
    <% form_for :customer do |form| %>
      <%= form.label :name %>
      <%= form.text_field :name %>
      <button type="submit">Create</button>
    <% end %>
    
    
    # feature
      Scenario: Customer is created with valid data
        Given no customer exists with a name of "My New Customer"
        When I go to the new customer page
        And I fill in "Name" with "My New Customer"
        And I press "Create"
        Then I should see "Successfully created!"
    

    This fails for Selenium because it cannot find the 'Create' button. The JS associated with this issue is located at WEBRAT_ROOT/lib/webrat/selenium/location_strategy_javascript/button.js; this JS only finds input element with a type attribute of submit or image; it should also match on the button element.

  • Luke Amdor

    Luke Amdor May 14th, 2009 @ 12:23 PM

    Fix for selenium location strategy is attached. I wasn't quite sure where the associated test was at, but I tried it manually and it works.

  • gaffo

    gaffo May 14th, 2009 @ 02:01 PM

    • State changed from “new” to “awaiting-merge”

    if you go into spec/integration/rails, you can run the selenium test task. Not all things pass, but that is where you would add a test.

    Need to verify patch

  • Matthias Marschall

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

    The above patch should be super-seeded by my patch for #254

  • gaffo

    gaffo May 29th, 2009 @ 06:15 PM

    • State changed from “awaiting-merge” to “duplicate”

    I believe #254 fixes this. If not please message and we'll re-open.

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

Attachments

Referenced by

Pages