0

我试图开始实现 watirgrid 以便我可以并行运行测试。这是我开始测试的示例代码

require 'watirgrid'
require 'pp'
require 'pp'
# Start a Controller

controller = Controller.new
controller.start
# Start a Provider
provider = Provider.new(:browser_type => 'safari')
provider.start
grid = Watir::Grid.new
grid.start(:take_all => true)
pp grid.browsers.first
# Take the first browser on the grid and execute some Watir
browser = grid.browsers.first[:object].new_browser
browser.goto "http://google.com"
browser.close

但是当我执行此代码时,我收到以下错误

C:\rubyprograms>ruby gridtesting.rb
I, [2013-11-26 16:57:38 #18484]  INFO -- : Controller started on : druby://10.33.115.126:56377

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/watirgrid-1.1.5/lib/provider.rb:110:in `start': Use RbConfig instead of obsolete and deprecated Config.

C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/watirgrid-1.1.5/lib/provider.rb:110:in `start': Use RbConfig instead of obsolete and deprecated Config.

I, [2013-11-26 16:57:39 #18484]  INFO -- : Provider started on   : druby://10.33.115.126:56378

C:/Ruby200-x64/lib/ruby/2.0.0/rinda/ring.rb:180:in `lookup_ring': undefined method `each' for "10.33.115.126":String (NoMethodError)
        from C:/Ruby200-x64/lib/ruby/2.0.0/rinda/ring.rb:202:in `block in lookup_ring_any'
4

1 回答 1

0

这是 ruby​​ 1.9.X 用户的常见错误。并且在 gem 的github 页面中,创建者实际上已经展示了如何处理这个问题。去引用:

字符串在 Ruby 1.9.2 中不再可枚举,因此您可能会看到如下错误:

NoMethodError: undefined method each' for "192.168.0.134":String
from C:/RailsInstaller/Ruby1.9.2/lib/ruby/1.9.1/rinda/ring.rb:180:inlookup_ring

用于 Rinda 的 Ruby 核心库已损坏,因为它错误地在字符串上使用了 each 方法。在不使用猴子补丁的情况下,您可以通过不使用查找中使用的 DRb 广播方法来避免 watirgrid 中的此错误。当您未指定控制器 URI 时会发生这种情况。为避免这种情况:如果从命令行启动提供程序,请指定控制器 URI

provider -c druby://203.51.48.187:11235 -d webdriver -b chrome
I, [2011-11-01 20:25:25 #49264]  INFO -- : Provider started on   : druby://203.51.48.187:54289
I, [2011-11-01 20:25:25 #49264]  INFO -- : Controller found on   : druby://203.51.48.187:11235
I, [2011-11-01 20:25:25 #49264]  INFO -- : Provider registered   : druby://203.51.48.187:11235
于 2013-11-26T06:57:37.640 回答