0

我无法使用 Watir 识别富文本框。所以我试着用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。

宝石:

  • 大十进制 (1.1.0)
  • 建设者(3.0.0)
  • 普通人 (3.0.0)
  • ffi (1.0.10 x86-mingw32)
  • 锄头 (3.0.6)
  • io 控制台 (0.3)
  • json (1.5.4)
  • 迷你测试(2.5.1)
  • nokogiri (1.5.3 x86-mingw32)
  • 耙子 (0.9.2.2)
  • r自动化(0.7.2)
  • rdoc (3.9.4)
  • rubygems 更新 (1.8.24)
  • s4t-utils (1.0.4)
  • 用户选择 (1.1.6.1)
  • 瓦提尔 (3.0.0, 1.5.3)
  • 水经典(3.0.0)
  • win32-api (1.4.8)
  • win32 进程 (0.6.5)
  • windows-api (0.4.1)
  • windows-pr (1​​.2.1)
  • xml-简单 (1.1.1)
4

1 回答 1

2

尝试:

browser.send_keys :tab

我相信 Watir 3.0 将 send_keys 方法更改为 Watir-Webdriver 中的方法 - 请参阅http://watirmelon.com/tag/send_keys/

于 2012-06-13T13:01:49.067 回答