Hi,

require 'rubygems'
require 'watir-webdriver'

children=[]
count=0
fact=0
5.times do
children<<Thread.new do
    1.times do
    fact+=1
    begin
    br=Watir::Browser.new :ie
    br.goto('some-site')
    br.link(:text,'Sign In').click
    count+=1 if br.text_field(:id,'username').exist?
ensure
    br.close
end
    end
end
end
children.each do |c|
    c.join
end
puts "fact: #{fact} count: #{count}"

Giving me following error:
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `initialize': No connect
ion could be made because the target machine actively refused it. -
connect(2) (Errno::ECONNREFUSED)
       from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `open'
       from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `block in
connect'
       from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
       from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
       from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `connect'
       from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
       from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start'
       from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/http/default.rb:83:in
`response_for'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/http/default.rb:39:in
`request'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/http/common.rb:40:in
`call'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/bridge.rb:598:in
`raw_execute'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/bridge.rb:576:in
`execute'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/remote/bridge.rb:189:in
`quit'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/ie/bridge.rb:59:in
`quit'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.26.0/lib/selenium/webdriver/common/driver.rb:166:in
`quit'
       from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:87:in
`close'
       from focus.rb:17:in `ensure in block (3 levels) in <main>'
       from focus.rb:17:in `block (3 levels) in <main>'
       from focus.rb:9:in `times'
       from focus.rb:9:in `block (2 levels) in <main>'

-- 
Posted via http://www.ruby-forum.com/.