I'm getting undefined method 'send_keys'
when running feature tests in our Ruby on Rails application we've been using over the past 3 years when trying to run our rspec-capybara tests
We have the gem 'selenium-webdriver', '~> 2.47.1'
in our Gemfile
and it shows in Gemfile.lock
we suspect we're not using the right driver but given our Gemfile
, not sure why not
HTML we're targeting:
<input class="zip-code-input" id="landing-zip-code" maxlength="5" name="landing[zip_code]"
pattern="[0-9]*" placeholder="ZIP Code" size="5" tabindex="1" title="Five-Digit ZIP Code"
value="" type="text">
I see a lot of references to rack in the Gemfile.lock, i.e.
$ bundle | grep rack
Using rack 1.4.7
Using crack 0.3.2
Using rack-cache 1.5.1
Using rack-test 0.6.3
Using rack-ssl 1.3.4
Using rack-protection 1.5.3
Using rack_session_access 0.1.1
but I've been unable to find any way to change that
send_keys is documented here:
https://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/Element.html#send_keys-instance_method
答案 0 :(得分:0)
如果你使用的是capybara gem,如果你想填写文本字段,那么你必须使用以下语法。
fill_in&#39; landing-zip-code&#39;,用:&#39; 123456&#39;
找到参考here