我试图开始实现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'
答案 0 :(得分:0)
这是ruby 1.9.X用户的常见错误。在gem的github page中,创建者实际上已经展示了如何处理这个问题。引用:
在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核心库因为错误地在字符串上使用每个方法而被破坏。如果不使用猴子补丁,可以通过不使用查找中使用的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