Ruby - watir:无法获得IEnum接口

时间:2010-10-14 21:41:15

标签: ruby watir

我正在使用Windows XP,我需要使用带有ruby的watir,安装进行得很顺利,我的最后一次尝试是遵循这里的说明Failed WATIR installation Server 2003并且一切正常,除了这个“错误:生成文档时对于builder-2.1.2“然后安装完成没有更多的问题。

问题是,当我尝试运行示例脚本来执行谷歌搜索时,调用set函数时出现错误,到目前为止我还没有找到任何有用的信息,如果有人能帮我一把这将是伟大的:))

顺便说一下,这里http://www.mail-archive.com/wtr-general@rubyforge.org/msg07722.html他们说它与WIN32OLE有关,但他们没有解释如何解决它(或者至少我没有得到它:s)

我安装的版本是


    ruby -v
    ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

    gem env
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.3.7
      - RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
      - INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
      - RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
      - EXECUTABLE DIRECTORY: c:/ruby/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86-mswin32-60
      - GEM PATHS:
         - c:/ruby/lib/ruby/gems/1.8
         - C:/Documents and Settings/jamontoya/.gem/ruby/1.8
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - http://rubygems.org/

错误

c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/locator.rb:119:in `each': failed to get IEnum Interface (RuntimeError)
    HRESULT error code:0x80004002
      No such interface supported       from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/locator.rb:119:in `locate'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/container.rb:838:in `locate_input_element'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/input_elements.rb:5:in `locate'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:54:in `assert_exists'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:315:in `enabled?'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/element.rb:62:in `assert_enabled'
        from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.6.6/lib/watir/input_elements.rb:364:in `set'
        from Search.rb:29

示例代码(Search.rb) 我删除了评论和其他不必要的行


    require "watir"

    test_site = "http://www.google.com"

    browser = Watir::Browser.new
    browser.goto test_site
    browser.text_field(:name, "q").set("pickaxe")  # here is the error when set is called
    browser.button(:name, "btnG").click
    browser.close

宝石列表 以防您需要知道

*** LOCAL GEMS ***

activesupport (2.3.9)
builder (2.1.2)
commonwatir (1.6.6)
firewatir (1.6.6)
fxri (0.3.6)
fxruby (1.6.12 mswin32)
hoe (2.6.2)
hpricot (0.6 mswin32)
json_pure (1.4.6)
log4r (1.0.5)
nokogiri (1.4.3.1 x86-mswin32)
rake (0.8.7, 0.7.3)
rubyforge (2.0.4)
rubygems-update (1.3.7)
s4t-utils (1.0.4)
sources (0.0.1)
user-choices (1.1.6.1)
watir (1.6.6)
win32-api (1.4.6 x86-mswin32-60, 1.0.4 mswin32)
win32-clipboard (0.4.3)
win32-dir (0.3.2)
win32-eventlog (0.4.6)
win32-file (0.5.4)
win32-file-stat (1.2.7)
win32-process (0.6.2, 0.5.3)
win32-sapi (0.1.4)
win32-sound (0.4.1)
windows-api (0.4.0, 0.2.0)
windows-pr (1.0.9, 0.7.2)
xml-simple (1.0.12)

1 个答案:

答案 0 :(得分:0)

您链接的

Watir can't find IEnum interface帖子说:

  

我最好的建议是卸载和   重新安装Ruby,然后重新安装Watir   在新的Ruby

之上

这也是我的建议。