由于未找到单一化方法,firefox 和 watir 无法在 Windows 上运行,这是怎么回事?
我刚刚在 Windows XP SP3 32 位上安装了 ruby 1.8.7 的全新副本。 安装 watir。
我使用了维基百科的例子:
require 'rubygems'
require 'watir/ie'
Watir::Browser.default = 'ie'
b = Watir::Browser.new
b.goto("http://www.google.com")
到目前为止一切顺利,按预期工作
,现在
require 'rubygems'
require 'watir/ie'
Watir::Browser.default = 'firefox'
b = Watir::Browser.new
b.goto("http://www.google.com")
抛出了一个丑陋的
C:\Documents and Settings\Administrator\Desktop>ruby watir2.rb
C:/Ruby187/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/browser.rb:89:in `
klass': undefined method `singularize' for "Buttons":String (NoMethodError)
from C:/Ruby187/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/ele
ment_collections.rb:185
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from C:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from C:/Ruby187/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir.rb:
29
from (eval):1:in `klass'
from C:/Ruby187/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/brows
er.rb:65:in `eval'
from C:/Ruby187/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/brows
er.rb:89:in `klass'
from C:/Ruby187/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/brows
er.rb:65:in `new'
from watir2.rb:7
东西应该提到的是,我已经遵循了那里记录的过程 http://watir.com/installation/#win 此外,我认为这是不相关的,但我确实按预期安装了 jssh firefox 插件。
这个未定义的方法“singularize”代表什么?
下面是一些环境信息
C:\Documents and Settings\Administrator\Desktop>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby187/lib/ruby/gems/1.8
- RUBY EXECUTABLE: C:/Ruby187/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby187/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby187/lib/ruby/gems/1.8
- C:/Documents and Settings/Administrator/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
C:\Documents and Settings\Administrator\Desktop>gem list
*** LOCAL GEMS ***
activesupport (3.0.0)
builder (2.1.2)
commonwatir (1.6.5)
firewatir (1.6.5)
hoe (2.6.1)
json_pure (1.4.6)
nokogiri (1.4.3.1 x86-mingw32)
rake (0.8.7)
rubyforge (2.0.4)
s4t-utils (1.0.4)
user-choices (1.1.6.1)
watir (1.6.5)
win32-api (1.4.6 x86-mingw32)
win32-process (0.6.2)
windows-api (0.4.0)
windows-pr (1.0.9)
xml-simple (1.0.12)
C:\Documents and Settings\Administrator\Desktop>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
维基百科文章不是由 Watir 团队维护的,因此它可能不是最新的。请仅使用 watir.com 中的示例。
我查看了维基百科文章,但在任何地方都找不到
require 'watir/ie'
,请仅使用require 'watir'
。我已经安装了 Ruby 1.8.7-p302 来自 rubyinstaller.org/downloads 在完全修补的 XP SP3 32 位计算机上,并使用
gem 安装 watir
。我已经安装了 Firefox 3.6.8 和 Firefox 3.6 的 Windows 插件 来自 watir.com/installation。
我已经执行了 watir.com/examples 中的代码,
但我
真的很奇怪。这曾经有效。
如果你想用 Watir 驱动 Firefox,我建议 watir-webdriver gem 直到这个问题被修复。
Wikipedia article is not maintained by Watir team, so it is probably not up to date. Please use only examples from watir.com.
I took a look at Wikipedia article and I could not find
require 'watir/ie'
anywhere, please use justrequire 'watir'
.I have installed Ruby 1.8.7-p302 from rubyinstaller.org/downloads on a fully patched XP SP3 32 bit machine, and installed Watir with
gem install watir
.I have installed Firefox 3.6.8 and Windows plugin for Firefox 3.6 from watir.com/installation.
I have executed code from watir.com/examples
but I got
Really strange. That used to work.
If you want to drive Firefox with Watir, I would suggest watir-webdriver gem until this is fixed.
只需在代码中的某处执行
require 'active_support'
即可。看起来这些人没有指定 active_support 作为依赖项。 在这里添加咆哮Just do
require 'active_support'
somewhere in your code. Looks like the guys didn't specify active_support as dependency. add rant here适用于 1.8.6 (mingw) + active_support 2.3.8 + watir (尽管当我在 Firefox 中使用它时,我收到一条“请安装 jssh”消息)。
我的第一个预感是,gems 之间存在一些冲突,而 rubygems“总是选择第一个”。
您可以安装 gem_conflict_checker gem(其中包括一个 rubygems 插件来测试相同的情况)。安装它,然后安装 watir gem,它应该告诉您现有的冲突。
为了回答您原来的问题,这里是单数: http://blog.jayfields.com/ 2007/11/stringsingularize.html
-r
works for me with 1.8.6 (mingw) + active_support 2.3.8 + watir (though I get a "please install jssh" message when I use it with firefox).
My first hunch is that you have some conflict among gems, and rubygems "always chooses the first"
You could install the gem_conflict_checker gem (which includes a rubygems plugin to test for the same). Install it then install the watir gem and it should tell you of existing conflict.
In answer to your original question, here's singularize: http://blog.jayfields.com/2007/11/stringsingularize.html
-r