已经安装好ruby和watir为什么运行出错?解决方法
发布时间:2011-06-29 18:43:43 文章来源:www.iduyao.cn 采编人员:星星草
已经安装好ruby和watir为什么运行出错?
我从 http://rubyforge.org/frs/?group_id=167下载里 1.8.6-27 版本并安装好,接下来通过网络安装了watir
命令是: gem install watir
然后从网上摘了一段测试代码:
#-------------------------#
# Demo test for the Watir controller.
#
# Simple Google test written by Jonathan Kohl 10/10/04.
# Purpose: to demonstrate the following Watir functionality:
# * entering text into a text field,
# * clicking a button,
# * checking to see if a page contains text.
# Test will search Google for the "pickaxe" Ruby book.
#-------------------------#
# the Watir controller
require "watir"
# set a variable
test_site = "http://www.google.com"
#open the IE browser
ie = Watir::IE.new
# print some comments
puts "Beginning of test: Google search."
puts " Step 1: go to the test site: " + test_site
ie.goto test_site
puts " Step 2: enter 'pickaxe' in the search text field."
ie.text_field(:name, "q").set "pickaxe" # "q" is the name of the search field
puts " Step 3: click the 'Google Search' button."
ie.button(:name, "btnG").click # "btnG" is the name of the Search button
puts " Expected Result:"
puts " A Google page with results should be shown. 'Programming Ruby' should be high on the list."
puts " Actual Result:"
if ie.text.include? "Programming Ruby"
puts " Test Passed. Found the test string: 'Programming Ruby'. Actual Results match Expected Results."
else
puts " Test Failed! Could not find: 'Programming Ruby'."
end
puts "End of test: Google search."
在SciTE里运行后就出现:
>ruby google_search.rb
google_search.rb:12:in `require': no such file to load -- watir (LoadError)
from google_search.rb:12
>Exit code: 1
这是为什么?是没有安装好watir?
------解决方案--------------------
一起学习了
http://www.ruby-lang.org.cn/forums/thread-520-1-17.html
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。
其他相似内容:
-
Redmine+Git,在版本库菜单中404错误怎么回事?
在配置中用Git方式管理代码,加上了本地Git库路径:
/home/git/repositories/project.g...
-
一段RUBY代码,既不报错,但是不输出结果,帮忙看下
class Song
def initialize(name,artist,duration)
@name = name
@ar...
-
有没有人使用《Web开发敏捷之道》这本书的测试出了问题啊……
正在用《Web开发敏捷之道》第3版,测试这一块出现了问题,然后接着问题...
-
关于rake命令撤销 migrations
我这里遇到一个难题:
a.) ruby script/generation migration add_price_to_product_99 price:decima...
-
Ruby on Rails 如何实现完成大型数据库的实现与管理及维护
前些天在一家公司实习进行Web开发时 所用的语言是ruby 环境是 rails ...
-
RoR菜鸟求助
我在Windows系统上安装了ruby 1.9.3p0 (2011-10-30) [i386-mingw32],
然后安装了Rails 3.1.2,
因为mysql2 0.3.10没有w...
-
三个月可以做个EC网站吗?
像这种规模的:
http://www.infotop.jp
顺便问一下,在中国有这样的信息素材网站吗?
------解决方案-------...
-
网上的rails视频中用的是什么IDE
网上有一些老外的rails讲解视频,我想问下他们用的那个是什么IDE,不胜感激
------解决方案-------...
-
安装gem的路径问题
近日需要使用redis, 因为网络连不上gem, 我下载了源码准备本地安装.安装时一切顺利, gem list也显示已经安装...
-
ruby 连接 mysql 的问题
想用ruby 连接 mysql
修改database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure ...