0

I want to implement watirgrid, but I'm not able to do that, every time I'm getting errors related with controller and provider starting process, Also all the example over internet, none of them are working.

Could any one please help me to implement this, a full running example with steps will be a great help.

I'm trying this code:

require 'rubygems'
require 'watirgrid'
require 'watir'
require 'watir-webdriver'

# setup a controller on port 12351 for your new grid
controller = Controller.new(:ring_server_port => 12351, :loglevel => Logger::ERROR)
controller.start

# add a provider to your grid
# :browser_type => 'webdriver' if using webdriver or
# :browser_type => 'ie' if using watir...
provider = Provider.new(:controller_uri => 'druby://127.0.0.1:11235',
                        :ring_server_port => 12351,
                        :loglevel => Logger::ERROR, 
                        :browser_type => 'webdriver')
provider.start

# connect to the grid and take all providers from it (this time only one)
grid = Watir::Grid.new(:ring_server_port => 12351, :ring_server_host => '127.0.0.1')
grid.start(:take_all => true)

# for each provider on the grid, launch a new thread to start multiple browsers
threads = []
grid.browsers.each do |browser|
  threads << Thread.new do
    p browser[:hostname]
    p browser[:architecture]
    p browser[:browser_type]
     # in this case we are starting a new IE browser
    b = browser[:object].new_browser(:ie)
    b.goto("http://www.google.com")
    b.text_field(:name, 'q').set("watirgrid")
    b.button(:name, "btnI").click
  end
end
threads.each {|thread| thread.join}

And Errors I'm getting is

DRb::DRbConnError: druby://127.0.0.1:11235 - #<Errno::ECONNREFUSED: No connection could  
be made because the target machine actively refused it. - connect(2)>
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:736:in `rescue in block in open'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:730:in `block in open'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:729:in `each'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:729:in `open'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:1191:in `initialize'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:1171:in `new'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:1171:in `open'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:1105:in `with_friend'
  from C:/Ruby192/lib/ruby/1.9.1/drb/drb.rb:1086:in `method_missing'
  from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watirgrid-1.1.5/lib/provider.rb:141:in `start'
  from (irb):44
  from C:/Ruby192/bin/irb:12:in `<main>'
irb(main):045:0>
Chuck van der Linden
  • 6,660
  • 2
  • 28
  • 43
Gaurav Sharma
  • 349
  • 4
  • 13

1 Answers1

-1

I got the same problem, I got the provider started successfully by changing the

controller_uri

to

controller_uri => 'druby://machineIPAddress:11235'
slavoo
  • 5,798
  • 64
  • 37
  • 39
Anhui
  • 1
  • 1