gem update --system
gem install watir
安装完成后用下面例子来测试:
require 'watir'
ie = Watir::IE.new
ie.goto('http://www.g.cn')
如果能够打开'http://www.g.cn'就说明安装成功
可惜我没有安装成功,提示以下错误
d:/Ruby/lib/ruby/gems/1.8/gems/windows-pr-0.9.3/lib/windows/thread.rb:59:
uninitialized constant Windows::API::Error (NameError)
from
d:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from
d:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from
d:/Ruby/lib/ruby/gems/1.8/gems/win32-process-0.5.9/lib/win32/process.rb:3
from d:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from
d:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from d:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie-process.rb:1
from d:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
from
d:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from d:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.2/lib/watir/ie.rb:45
from
web.rb:17
在谷歌搜索找到这个网址 http://www.zhuaijun.cn/archives/53 ,他的原帖是:
出现这个问题是因为windows-pr版本的问题引起了。
0.9.3版本有个小问题
结果的办法是先Gem uninstall
windows-pr
然后再运行 Gem install windows-pr
OK,已经搞定
|
请发表评论