History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WTR-192
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Charley Baker
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Watir

wait needs timeouts (sample code provided)

Created: 10/Jan/08 11:13 AM   Updated: 29/Oct/08 03:31 PM
Component/s: "Wait"
Affects Version/s: 1.5.3
Fix Version/s: 1.6.2

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
There are a few loops inside wait that need to have timeouts added.

        while @ie.busy # XXX need to add time out
          sleep a_moment
        end
        until @ie.readyState == READYSTATE_COMPLETE do # need time out
          sleep a_moment
        end

          until doc.readyState == "complete" do # need time out
            sleep a_moment
          end

Otherwise if ie doesn't return the right value Watir hangs.
Noticed this on yahoo's finance page when streaming quotes are turned on:
http://finance.yahoo.com/q?s=ROST

 All   Comments   Work Log   Change History      Sort Order:
Tony - 05/Sep/08 05:46 AM
Hi,
i have tested the below code successfully when the page is stuck loading continuously.
This should timeout when ie is loading for more than 30 secs.
Also a method could be added to set the timeout.
The timeout in watir and firewatir would have to be set to the same value.

def wait(no_sleep=false)
      @rexmlDomobject = nil
      @down_load_time = 0.0
      a_moment = 0.2 # seconds
      start_load_time = Time.now
      
      @tcount = 150 if @tcount.nil? ## -- this is the calculated count ... numofsecs/a_moment (150 = 30 secs)ss
      acount=1
      
      begin
        while @ie.busy && acount < @tcount# XXX need to add time out
          #puts "WAITING@@@@@@@@ #{acount}"
          acount += 1
          sleep a_moment
        end
        raise "Timeout Exception : Timeout after #{acount * a_moment}secs" if acount == @tcount

... the remaing code in wait method.

def setTimeOut(val=30) #mention the number of seconds
      @tcount = val/0.2 ## -- this 0.2 is supposed to be a_moment
end

-Tony

Kirill Paliy - 29/Oct/08 03:31 PM
I'm suffering from sporadic Watir hang ups, added some logging to ie.rb and found that it hangs if frame with about:blank appears. As a temporary workaround I hacked ie.rb

      while doc = documents_to_wait_for.shift
        begin
          until doc.readyState == "complete" or doc.readyState == "uninitialized" do

Not sure if this conforms project coding style but I believe it's better to skip such a frames rather than wait on them.