• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Ruby+watir自动化测试环境搭建

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

下载ruby的windows版本的安装程序,下载地址:http://rubyforge.org/frs/?group_id=167或者http://files.rubyforge.vm.bytemark.co.uk/rubyinstaller/

下载exe版本的ruby,我下载的是rubyinstaller-1.9.3-p327.exe,有人说ruby1.9.3版本的不稳定,建议用ruby1.8.6版本的,也不知道哪里不稳定,就捡这个版本用吧, 187、192、193版本的没有这个SciTE编辑器(可以网上下载)。

安装过程倒是很简单,直接安装在C盘的根目录下即可(C:\Ruby),下面的3个选项选中,一路【Next】安装成功。

进入CMD命令提示行,来对Rubygems进行升级,并安装watir,他们都是通过网络安装的,执行前最好把本地的防火墙关掉。

具体的安装可以参考:http://watir.com/installation/

gem update –system(如果网络安装rubygems失败,可以尝试http://rubyforge.org/frs/?group_id=126下载最新版,线下安装)

gem install watir[版本号] #不写版本号则取最新版本

C:\Documents and Settings\Administrator>gem -v

1.8.24

C:\Documents and Settings\Administrator>ruby -v

ruby 1.9.3p327 (2012-11-10) [i386-mingw32]

C:\>cd Ruby

C:\Ruby>gem update --system

Updating installed gems

Nothing to update

C:\Ruby>gem install watir -v 3.0.0

Fetching: commonwatir-4.0.0.gem (100%)

Fetching: multi_json-1.3.7.gem (100%)

Fetching: rubyzip-0.9.9.gem (100%)

Fetching: ffi-1.2.0-x86-mingw32.gem (100%)

Fetching: childprocess-0.3.6.gem (100%)

Fetching: websocket-1.0.3.gem (100%)

Fetching: libwebsocket-0.1.6.1.gem (100%)

Fetching: selenium-webdriver-2.26.0.gem (100%)

Fetching: watir-webdriver-0.6.1.gem (100%)

Fetching: win32-process-0.7.0.gem (100%)

Fetching: win32-api-1.4.8-x86-mingw32.gem (100%)

Fetching: windows-api-0.4.2.gem (100%)

Fetching: windows-pr-1.2.2.gem (100%)

Fetching: nokogiri-1.5.5-x86-mingw32.gem (100%)

Fetching: rautomation-0.7.3.gem (100%)

Fetching: xml-simple-1.1.2.gem (100%)

Fetching: hoe-3.3.0.gem (100%)

Fetching: s4t-utils-1.0.4.gem (100%)

Fetching: builder-3.1.4.gem (100%)

Fetching: user-choices-1.1.6.1.gem (100%)

Fetching: subexec-0.0.4.gem (100%)

Fetching: mini_magick-3.2.1.gem (100%)

Fetching: win32screenshot-1.0.7.gem (100%)

Fetching: watir-classic-3.3.0.gem (100%)

Fetching: watir-4.0.2-x86-mingw32.gem (100%)

Successfully installed commonwatir-4.0.0

Successfully installed multi_json-1.3.7

Successfully installed rubyzip-0.9.9

Successfully installed ffi-1.2.0-x86-mingw32

Successfully installed childprocess-0.3.6

Successfully installed websocket-1.0.3

Successfully installed libwebsocket-0.1.6.1

Successfully installed selenium-webdriver-2.26.0

Successfully installed watir-webdriver-0.6.1

Successfully installed win32-process-0.7.0

Successfully installed win32-api-1.4.8-x86-mingw32

Successfully installed windows-api-0.4.2

Successfully installed windows-pr-1.2.2

Successfully installed nokogiri-1.5.5-x86-mingw32

Successfully installed rautomation-0.7.3

Successfully installed xml-simple-1.1.2

Successfully installed hoe-3.3.0

Successfully installed s4t-utils-1.0.4

Successfully installed builder-3.1.4

Successfully installed user-choices-1.1.6.1

Successfully installed subexec-0.0.4

Successfully installed mini_magick-3.2.1

Successfully installed win32screenshot-1.0.7

Successfully installed watir-classic-3.3.0

Successfully installed watir-4.0.2-x86-mingw32

25 gems installed

Installing ri documentation for commonwatir-4.0.0...

Installing ri documentation for multi_json-1.3.7...

Installing ri documentation for rubyzip-0.9.9...

Installing ri documentation for ffi-1.2.0-x86-mingw32...

Enclosing class/module 'moduleFFI' for class AbstractMemory not known

Enclosing class/module 'moduleFFI' for class NullPointerError not known

Enclosing class/module "classMemory" for alias put_" #name, "put_" #old); \

    rb_define_alias(classMemory, "get_" #name, "get_" #old); \

    rb_define_alias(classMemory, "put_u" #name, "put_u" #old); \

    rb_define_alias(classMemory, "get_u" #name, "get_u" #old); \

    rb_define_alias(classMemory, "write_" #name, "write_" #old); \

    rb_define_alias(classMemory, "read_" #name, "read_" #old); \

    rb_define_alias(classMemory, "write_u" #name, "write_u" #old); \

    rb_define_alias(classMemory, "read_u" #name, "read_u" #old); \

    rb_define_alias(classMemory, "put_array_of_" #name, "put_array_of_" #old); \

 

    rb_define_alias(classMemory, "get_array_of_" #name, "get_array_of_" #old); \

 

    rb_define_alias(classMemory, "put_array_of_u" #name, "put_array_of_u" #old);

 \

    rb_define_alias(classMemory, "get_array_of_u" #name, "get_array_of_u" #old);

 \

    rb_define_alias(classMemory, "write_array_of_" #name, "write_array_of_" #old

); \

    rb_define_alias(classMemory, "read_array_of_" #name, "read_array_of_" #old);

 \

    rb_define_alias(classMemory, "write_array_of_u" #name, "write_array_of_u" #o

ld); \

    rb_define_alias(classMemory, "read_array_of_u" #name, "read_array_of_u" #old

);

 

    ALIAS(char, int8);

    ALIAS(short, int16);

    ALIAS(int, int32);

    ALIAS(long_long, int64);

 

    /*

     * Document-method: put_float32

     * call-seq: memory.put_float32offset, value)

     * @param [Numeric] offset

     * @param [Numeric] value

     * @return [self]

     * Put +value+ as a 32-bit float in memory at offset +offset+ (alias: #put_f

loat).

     */

    rb_define_method(classMemory, "put_float32", memory_put_float32, 2);

    /*

     * Document-method: get_float32

     * call-seq: memory.get_float32(offset)

     * @param [Numeric] offset

     * @return [Float]

     * Get a 32-bit float from memory at offset +offset+ (alias: #get_float).

     */

    rb_define_method(classMemory, "get_float32", memory_get_float32, 1);

    rb_define_alias(classMemory, "put_float put_float32 not known

Enclosing class/module "classMemory" for alias get_float get_float32 not known

Enclosing class/module "classMemory" for alias put_array_of_float put_array_of_f

loat32 not known

Enclosing class/module "classMemory" for alias get_array_of_float get_array_of_f

loat32 not known

Enclosing class/module "classMemory" for alias put_double put_float64 not known

Enclosing class/module "classMemory" for alias get_double get_float64 not known

Enclosing class/module "classMemory" for alias put_array_of_double put_array_of_

float64 not known

Enclosing class/module "classMemory" for alias get_array_of_double get_array_of_

float64 not known

Enclosing class/module "classMemory" for alias size total not known

Enclosing class/module 'moduleFFI' for class ArrayType not known

Enclosing class/module 'moduleFFI' for class Buffer not known

Enclosing class/module "BufferClass" for alias length total not known

Enclosing class/module 'moduleFFI' for module DataConverter not known

Enclosing class/module 'moduleFFI' for class DynamicLibrary not known

Enclosing class/module 'LibraryClass' for class Symbol not known

Enclosing class/module 'rbffi_TypeClass' for class Mapped not known

Enclosing class/module 'rbffi_StructClass' for class InlineArray not known

Enclosing class/module 'rbffi_StructLayoutClass' for class CharArray not known

Enclosing class/module "rbffi_StructLayoutCharArrayClass" for alias to_str to_s

not known

Installing ri documentation for childprocess-0.3.6...

Installing ri documentation for websocket-1.0.3...

Installing ri documentation for libwebsocket-0.1.6.1...

Installing ri documentation for selenium-webdriver-2.26.0...

Installing ri documentation for watir-webdriver-0.6.1...

Installing ri documentation for win32-process-0.7.0...

Installing ri documentation for win32-api-1.4.8-x86-mingw32...

Installing ri documentation for windows-api-0.4.2...

Installing ri documentation for windows-pr-1.2.2...

Installing ri documentation for nokogiri-1.5.5-x86-mingw32...

unable to convert "\xE3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for CHANGELOG.ja.rdoc, skipping

unable to convert "\xE8" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for CHANGELOG.rdoc, skipping

unable to convert "\xE9" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for README.ja.rdoc, skipping

unable to convert "\xE9" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for README.rdoc, skipping

unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for ext/nokogiri/xml_node_set.c, skipping

Installing ri documentation for rautomation-0.7.3...

Installing ri documentation for xml-simple-1.1.2...

Installing ri documentation for hoe-3.3.0...

unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for README.txt, skipping

Installing ri documentation for s4t-utils-1.0.4...

Installing ri documentation for builder-3.1.4...

Installing ri documentation for user-choices-1.1.6.1...

Installing ri documentation for subexec-0.0.4...

Installing ri documentation for mini_magick-3.2.1...

Installing ri documentation for win32screenshot-1.0.7...

Installing ri documentation for watir-classic-3.3.0...

Installing ri documentation for watir-4.0.2-x86-mingw32...

Installing RDoc documentation for commonwatir-4.0.0...

Installing RDoc documentation for multi_json-1.3.7...

Installing RDoc documentation for rubyzip-0.9.9...

Installing RDoc documentation for ffi-1.2.0-x86-mingw32...

Enclosing class/module 'moduleFFI' for class AbstractMemory not known

Enclosing class/module 'moduleFFI' for class NullPointerError not known

Enclosing class/module "classMemory" for alias put_" #name, "put_" #old); \

    rb_define_alias(classMemory, "get_" #name, "get_" #old); \

    rb_define_alias(classMemory, "put_u" #name, "put_u" #old); \

    rb_define_alias(classMemory, "get_u" #name, "get_u" #old); \

    rb_define_alias(classMemory, "write_" #name, "write_" #old); \

    rb_define_alias(classMemory, "read_" #name, "read_" #old); \

    rb_define_alias(classMemory, "write_u" #name, "write_u" #old); \

    rb_define_alias(classMemory, "read_u" #name, "read_u" #old); \

    rb_define_alias(classMemory, "put_array_of_" #name, "put_array_of_" #old); \

 

    rb_define_alias(classMemory, "get_array_of_" #name, "get_array_of_" #old); \

 

    rb_define_alias(classMemory, "put_array_of_u" #name, "put_array_of_u" #old);

 \

    rb_define_alias(classMemory, "get_array_of_u" #name, "get_array_of_u" #old);

 \

    rb_define_alias(classMemory, "write_array_of_" #name, "write_array_of_" #old

); \

    rb_define_alias(classMemory, "read_array_of_" #name, "read_array_of_" #old);

 \

    rb_define_alias(classMemory, "write_array_of_u" #name, "write_array_of_u" #o

ld); \

    rb_define_alias(classMemory, "read_array_of_u" #name, "read_array_of_u" #old

);

 

    ALIAS(char, int8);

    ALIAS(short, int16);

    ALIAS(int, int32);

    ALIAS(long_long, int64);

 

    /*

     * Document-method: put_float32

     * call-seq: memory.put_float32offset, value)

     * @param [Numeric] offset

     * @param [Numeric] value

     * @return [self]

     * Put +value+ as a 32-bit float in memory at offset +offset+ (alias: #put_f

loat).

     */

    rb_define_method(classMemory, "put_float32", memory_put_float32, 2);

    /*

     * Document-method: get_float32

     * call-seq: memory.get_float32(offset)

     * @param [Numeric] offset

     * @return [Float]

     * Get a 32-bit float from memory at offset +offset+ (alias: #get_float).

     */

    rb_define_method(classMemory, "get_float32", memory_get_float32, 1);

    rb_define_alias(classMemory, "put_float put_float32 not known

Enclosing class/module "classMemory" for alias get_float get_float32 not known

Enclosing class/module "classMemory" for alias put_array_of_float put_array_of_f

loat32 not known

Enclosing class/module "classMemory" for alias get_array_of_float get_array_of_f

loat32 not known

Enclosing class/module "classMemory" for alias put_double put_float64 not known

Enclosing class/module "classMemory" for alias get_double get_float64 not known

Enclosing class/module "classMemory" for alias put_array_of_double put_array_of_

float64 not known

Enclosing class/module "classMemory" for alias get_array_of_double get_array_of_

float64 not known

Enclosing class/module "classMemory" for alias size total not known

Enclosing class/module 'moduleFFI' for class ArrayType not known

Enclosing class/module 'moduleFFI' for class Buffer not known

Enclosing class/module "BufferClass" for alias length total not known

Enclosing class/module 'moduleFFI' for module DataConverter not known

Enclosing class/module 'moduleFFI' for class DynamicLibrary not known

Enclosing class/module 'LibraryClass' for class Symbol not known

Enclosing class/module 'rbffi_TypeClass' for class Mapped not known

Enclosing class/module 'rbffi_StructClass' for class InlineArray not known

Enclosing class/module 'rbffi_StructLayoutClass' for class CharArray not known

Enclosing class/module "rbffi_StructLayoutCharArrayClass" for alias to_str to_s

not known

Installing RDoc documentation for childprocess-0.3.6...

Installing RDoc documentation for websocket-1.0.3...

Installing RDoc documentation for libwebsocket-0.1.6.1...

Installing RDoc documentation for selenium-webdriver-2.26.0...

Installing RDoc documentation for watir-webdriver-0.6.1...

Installing RDoc documentation for win32-process-0.7.0...

Installing RDoc documentation for win32-api-1.4.8-x86-mingw32...

Installing RDoc documentation for windows-api-0.4.2...

Installing RDoc documentation for windows-pr-1.2.2...

Installing RDoc documentation for nokogiri-1.5.5-x86-mingw32...

unable to convert "\xE3" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for CHANGELOG.ja.rdoc, skipping

unable to convert "\xE8" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for CHANGELOG.rdoc, skipping

unable to convert "\xE9" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for README.ja.rdoc, skipping

unable to convert "\xE9" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for README.rdoc, skipping

unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for ext/nokogiri/xml_node_set.c, skipping

Installing RDoc documentation for rautomation-0.7.3...

Installing RDoc documentation for xml-simple-1.1.2...

Installing RDoc documentation for hoe-3.3.0...

unable to convert "\xE2" to UTF-8 in conversion from ASCII-8BIT to UTF-8 to GBK

for README.txt, skipping

Installing RDoc documentation for s4t-utils-1.0.4...

Installing RDoc documentation for builder-3.1.4...

Installing RDoc documentation for user-choices-1.1.6.1...

Installing RDoc documentation for subexec-0.0.4...

Installing RDoc documentation for mini_magick-3.2.1...

Installing RDoc documentation for win32screenshot-1.0.7...

Installing RDoc documentation for watir-classic-3.3.0...

Installing RDoc documentation for watir-4.0.2-x86-mingw32...

然后再安装gem install watir-webdriver

验证ruby是否成功:

C:\Ruby>irb

irb(main):001:0> puts  
                       
                    
                    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
ruby(wrongnumberofarguments(1for2))发布时间:2022-07-14
下一篇:
Rubygem:Mac系统下的安装与更新发布时间:2022-07-14
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap