`rescue in rbuf_fill': Timeout: :Error (Timeout::Error) - selenium-webdriver

I am continuously getting an irritating error :

C:\Documents and Settings\rakshiar\My
Documents\userdata\Ruby\Scripts>So.rb
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in rescue in rbuf_fill': Timeout: :Error (Timeout::Error) from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:inrbuf_fill’
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in
readuntil' from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:inreadline’
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2562:in
read_status_line' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:inread_new’
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in block in transport_r equest' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:incatch’
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in
transport_request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:inrequest’
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1286:in block in request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:instart’
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.30.0/lib/s elenium/webdriver/remote/http/default.rb:83:inresponse_for’
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.30.0/lib/s
elenium/webdriver/remote/http/default.rb:39:in request' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.30.0/lib/s elenium/webdriver/remote/http/common.rb:40:incall’
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.30.0/lib/s
elenium/webdriver/remote/bridge.rb:615:in raw_execute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.30.0/lib/s elenium/webdriver/remote/bridge.rb:593:inexecute’
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.30.0/lib/s
elenium/webdriver/remote/bridge.rb:358:in clickElement' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.30.0/lib/s elenium/webdriver/common/element.rb:54:inclick’
from C:/Documents and Settings/rakshiar/My
Documents/userdata/Ruby/Scrip
ts/So.rb:75:in `’

=========================
Code to handle this:

begin
elem = wait.until { driver.title == “Condition View Page”}
driver.find_element(:name,‘btnDone’).click
rescue Timeout::Error,Selenium::WebDriver::Error::NoSuchElementError =>
e
retry
end

But no luck. What should I do? Why the error is not being rescued? What
should I fix in my code?

Thanks

Love U Ruby [email protected] wrote:

I am continuously getting an irritating error :

C:\Documents and Settings\rakshiar\My
Documents\userdata\Ruby\Scripts>So.rb
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill’:
Timeout:
:Error (Timeout::Error)

should I fix in my code?
Can’t really say for sure there…

Since we obviously can’t see line numbers, are you sure that rescue is
at line 146? Do double check.

Something else to try, is to rescue all exceptions and check the class
of the exception without the retry.

begin
  ..
rescue Exception => e
  puts "Exception #{e.class} : #{e}"
  raise e
end

Incidently, just putting retry inside rescue could result in an infinite
loop. Best to bound it with a counter.

I am getting the exact same error randomly in my test. I am using
selenium-webdriver and cucumber. I am trying to tackle this problem and
I have not seen any fix for it yet.

It’s supposed to stop after a certain amount of time. Otherwise you’ll
end up with a program which waits indefinitely.

If you want to extend the amount of time before a failure:

driver.manage.timeouts.page_load = 300 # 5 minutes

Thank you! I will try and look up what other timeouts there are and
extend all of them. I am still getting the error but it has not occurred
yet for navigating to a page since trying you solution