如何使用带有 selenium 网络驱动程序的 Capybara 发送密钥

How do I send keys using Capybara with selenium web driver

我知道水豚使用原生,我需要为此安装 gem 吗?

我正在尝试在搜索框中键入内容后按回车键

如果使用水豚 2.5 可以做到

input = find_field 'id, name, label of search box'
input.send_keys 'text to send', :enter

如果 capybara < 2.5 与 selenium 一起使用,它将是

input.native.send_keys 'text to send', :enter