0

Im trying to start implementing watirgrid so that i can run tests parallely.. this is the sample code i started to test

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

but when i execute this code im getting the following error

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'
Games Brainiac
  • 80,178
  • 33
  • 141
  • 199

1 Answers1

0

This is a common error for ruby 1.9.X users. And in the github page of the gem, the creators have actually shown how to handle this problem. To quote:

Strings are no longer enumerable in Ruby 1.9.2 so you may see errors like this:

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

The Ruby core library for Rinda is broken as it incorrectly uses the each method on a string. Without resorting to monkey patches, you can avoid this error in watirgrid by not using the DRb broadcast methods used in a lookup. This happens when you do not specify a controller URI. To avoid this: Specify the controller URI if starting a provider from the command line

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
Games Brainiac
  • 80,178
  • 33
  • 141
  • 199