[watir-webdriver] how to manage timeout for after click event

1,009 views
Skip to first unread message

Alex Shtayer

unread,
Mar 20, 2013, 12:48:16 PM3/20/13
to watir-...@googlegroups.com
Hi guys
 
I have next situation: When I click on one of buttons in my application, page is loading for more than two minutes and raise exception inside of watir-webdriver click method.
Obviously any waiters (like wait_until something) will not help in this situation, because exception is raised after event, not before action.
 
Code is simple:
browser.button(:type, "submit").click
or
browser.button(:type, "submit").wait_until_present.click
 
Exception:
 
C:/Ruby192/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill': Timeout::Error (Timeout::Error)
        from C:/Ruby192/lib/ruby/1.9.1/net/protocol.rb:134:in `rbuf_fill'
        from C:/Ruby192/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'
        from C:/Ruby192/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
        from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line'
        from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'
        from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request'
        from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:1177:in `request'
        from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:1170:in `block in request'
        from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:627:in `start'
        from C:/Ruby192/lib/ruby/1.9.1/net/http.rb:1168:in `request'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/re
mote/http/default.rb:82:in `response_for'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/re
mote/http/default.rb:38:in `request'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/re
mote/http/common.rb:40:in `call'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/re
mote/bridge.rb:598:in `raw_execute'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/re
mote/bridge.rb:576:in `execute'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/re
mote/bridge.rb:358:in `clickElement'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/co
mmon/element.rb:54:in `click'
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.2/lib/watir-webdriver/elements/
element.rb:131:in `click'
 
 
 

Dan

unread,
Mar 20, 2013, 1:07:29 PM3/20/13
to watir-...@googlegroups.com

Check this out.  Although I think waiting for a page to load for 2 minutes borders on unacceptable.

Alex Shtayer

unread,
Mar 20, 2013, 1:21:30 PM3/20/13
to watir-...@googlegroups.com
Great. Thanks Dan, I will try that solution
 

Chuck van der Linden

unread,
Mar 20, 2013, 7:30:30 PM3/20/13
to watir-...@googlegroups.com
I agree, he must have really loyal customers if they are willing to wait that long for a page to load.

(although truth be told I'm fighting that same performance battle right now with my current employer, so I greatly empathise

Alex Shtayer

unread,
Mar 22, 2013, 8:27:47 PM3/22/13
to watir-...@googlegroups.com
Solution worked like a charm.

Thanks Dan for it

Regarding delays, yes you absolutely right and I also think that is unacceptable, but I can't do anything, because I just must to run automation scripts on cheaper devices. Customers have much expensive ones:)
Reply all
Reply to author
Forward
0 new messages