0 votes
1 view
in Devops and Agile by (25k points)

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 the form

    Given I am on the Form page

    When I fill in "field1" with "value1"

    And I fill in "field2" with "value2"

    And I press "OK"

    Then I should see "Form submitted"

The problem is that I don't have the OK button in the form I need a way to do the "form.submit", without clicking any button or link - the same as happens when you press ENTER when you are in a form field using the browser.

I don't know how to tell capybara to submit a form. How can I do it?

1 Answer

0 votes
by (63.3k points)

You can access the selenium send_keys method to invoke a return event like

find_field('field2').native.send_key(:enter)

You can try sending a newline:

find_field('field2').native.send_key("\n")

Hope this helps!

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...