Ruby学习笔记_watir

错误现象:

uninitialized constant Watir::IE (NameError)


解决方案:

1. gem update --system 

2. gem install watir 

3. gem install win32-process

4. gem install watir-classic         #目前还不支持64位的Ruby所以安装的Ruby必须是32位的才能使用

第一个是对Rubygems升级,第二个是对安装watir。这两个过程都是要通过网络的。

3. 用rb文件测试: 

require 'rubygems'
require 'watir'
require 'watir-classic' 

ie = Watir::Browser.new
ie.goto("http://www.baidu.com")
如果ie被打开就Ok。

----------------------------------------------------------------------------------------------------------------------------------------------------------

Based on the error, my guess is that watir-classic is failing to install the nokogiri gem. Nokogiri does not currently support Ruby x64 on Windows - see https://github.com/sparklemotion/nokogiri/issues/864.

Two things you could try:

1. Use 32bit Ruby (as suggested in the Nokogiri issue)

2. Use a browser other than IE. By default, Browser.new will start IE using watir-classic. Using one of the other browsers will use watir-webdriver, which I do not believe is dependent on nokogiri.

Example:

require 'watir'
browser = Watir::Browser.new :chrome
browser.goto("http://www.google.com")


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值