我无法使用Watir识别Rich TextBox。所以我尝试使用browser.send_keys(“{tab}”)
按Tab键。但这会产生错误。我尝试卸载ffi-1.0.10-x86-mingw32.gem
并安装ffi -v 1.0.9,但这不起作用。我收到这样的错误:
irb(main):013:0> browser.send_keys("{tab}")
LoadError: cannot load such file -- ffi_c
from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.10-x86-mingw32/lib/ffi.rb:11:in `rescue in <top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.0.10-x86-mingw32/lib/ffi.rb:2:in `<top (required)>'
from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.7.2/lib/rautomation/adapter/win_32.rb:6:in `<top (required)>'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.7.2/lib/rautomation/window.rb:67:in `const_get'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rautomation-0.7.2/lib/rautomation/window.rb:67:in `initialize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:456:in `new'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:456:in `rautomation'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.0.0/lib/watir-classic/ie-class.rb:475:in `send_keys'
from (irb):13
from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):014:0>
我使用Watir 3.0.0, Ruby 1.9.3。
宝石:
答案 0 :(得分:2)
尝试:
browser.send_keys :tab
我相信Watir 3.0将send_keys方法更改为Watir-Webdriver中的方法 - 请参阅http://watirmelon.com/tag/send_keys/