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

后端 未结 12 1869
挽巷
挽巷 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:48

    A simple solution:

    When /^I submit the form$/ do
      page.evaluate_script("document.forms[0].submit()")
    end
    

    Worked for me with capybara-envjs. Should work with selenium as well.

提交回复
热议问题