提交没有按钮的表格

提交没有按钮的表格

本文介绍了黄瓜,水豚和硒-提交没有按钮的表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用黄瓜,水豚和硒驱动器的测试。该测试应转至表单并提交。普通文本为

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
    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 submited"

问题是我的表单中没有确定按钮 b我需要一种无需单击任何按钮或链接即可执行 form.submit的方法-与使用浏览器进入表单字段时按ENTER时的情况相同。

The problem is that I don't have the OK button in the formI 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?

推荐答案

您可以访问硒方法来调用返回事件,例如

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

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

这篇关于黄瓜,水豚和硒-提交没有按钮的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 23:35