`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:in
`rbuf_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:in `readline'
        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:in `read_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:in `catch'
        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:in `request'
        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: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.30.0/lib/s
elenium/webdriver/remote/http/default.rb:83:in `response_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:in `call'
        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:in `execute'
        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:in `click'
        from C:/Documents and Settings/rakshiar/My
Documents/userdata/Ruby/Scrip
ts/So.rb:75:in `<main>'

C:\Documents and Settings\rakshiar\My
Documents\userdata\Ruby\Scripts>gem --h
ERROR: Invalid option: --h. See 'gem --help'.

C:\Documents and Settings\rakshiar\My Documents\userdata\Ruby\Scripts>

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

···

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

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)

...

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?

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.

···

Love U Ruby <lists@ruby-forum.com> wrote:

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.

···

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

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

···

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

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

···

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

I also added

driver.manage.timeouts.read_timeout = 500

I will update later but after executing my test suite 3 times I haven't
seen the error yet. If/When it appears again I will update this.

···

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

This is also in combination with Joels answer.

This is what my timeouts look like

driver.manage.timeouts.implicit_wait = 30
driver.manage.timeouts.script_timeout = 30
driver.manage.timeouts.read_timeout = 500
driver.manage.timeouts.page_load = 60

···

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