Cucumber, capybara and selenium - Submitting a form without a button

后端 未结 12 2081
挽巷
挽巷 2021-02-01 18:14

I have a test using Cucumber, capybara and selenium driver. This test should go to a form and submit it. The normal text would be

  Scenario: Fill form
    Give         


        
12条回答
  •  南旧
    南旧 (楼主)
    2021-02-01 18:54

    You may probably roll your own step (And I submit the form with the link "Ok", for example), and emulate the submit functionality yourself.

    Here it is the javascript emulation dropped in Rails 3 to support "unobtrusive" (emphasis on the quotes) Javascript. The line

    Capybara::Driver::RackTest::Form.new(driver, js_form(self[:href], emulated_method)).submit(self)
    

    is probably the clue to answer your problem. The full code is here

提交回复
热议问题