如何使用 Capybara 和 selenium web 驱动程序发送密钥

-1 ruby selenium automation capybara

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

我在搜索框中输入后尝试按 Enter

Tho*_*ole 5

如果使用水豚 2.5 你可以做

input = find_field 'id, name, label of search box'
input.send_keys 'text to send', :enter
Run Code Online (Sandbox Code Playgroud)

如果将水豚 < 2.5 与硒一起使用,它将是

input.native.send_keys 'text to send', :enter
Run Code Online (Sandbox Code Playgroud)