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>'
on 2012-11-29 08:32
on 2012-11-29 10:32
Joel Pearson wrote in post #1087040:
> It looks like your browser can't establish a connection. Firewall?
I can see that it opens few ie window and then throws the error. Even on
irb i can atart a browser and go to url etc.. By the way if its the case
of firewall.. Then how can I check that?
on 2012-11-29 11:19
On Thu, Nov 29, 2012 at 10:32 AM, Prog Rammer <lists@ruby-forum.com> wrote: > Joel Pearson wrote in post #1087040: >> It looks like your browser can't establish a connection. Firewall? > > I can see that it opens few ie window and then throws the error. Even on > irb i can atart a browser and go to url etc.. You may also fall victim of a connection count restriction as is usually present in client Windows systems. > By the way if its the case > of firewall.. Then how can I check that? Check firewall logs. Where they reside depends on the firewall used. Kind regards robert
on 2012-11-29 11:56
> You may also fall victim of a connection count restriction as is > usually present in client Windows systems. > But I am opening only 5 browsers at a time. > > Check firewall logs. Where they reside depends on the firewall used. > followed http://technet.microsoft.com/en-us/library/cc75378... no logs I found, i mean its blank.
on 2012-11-29 14:57
I've also seen that error before when the browser is closed in the middle of doing something. Maybe "br.close" is triggering while the thread is still doing something?
on 2012-12-04 12:46
Joel Pearson wrote in post #1087112: > I've also seen that error before when the browser is closed in the > middle of doing something. Maybe "br.close" is triggering while the > thread is still doing something? How can it be triggered without reason?
on 2012-12-04 13:25
Prog Rammer wrote in post #1087069: >> You may also fall victim of a connection count restriction as is >> usually present in client Windows systems. >> > But I am opening only 5 browsers at a time. How many browsers can you use like this before you experience the error? If it's consistent then as Robert said, it might well be the connection count. Don't forget you may have other processes running which can all add up. With regard to the browser closing, it's more of a direction to look in than a specific pointer... try closing the browser manually during execution and see if the error is exactly the same. You could also add a rescue and log to see whether every subsequent browser window experiences the same error.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.