Hi Chethan,

Iam not sure what you are actually trying to do.
Are you trying to say that sometimes when your website is down, watir
just waits for the page to load indefinitely, hence your testcase just
gets stuck.
I assume you want to create a timeout exception when this occurs.

You could modify the watir wait method to include a timeout.

module Watir
  class IE
    def wait(no_sleep=false)
      @rexmlDomobject = nil
      @down_load_time = 0.0
      a_moment = 0.2 # seconds
      @tcount = 150  if @tcount.nil?  ## -- this is the calculated
count ... numofsecs/a_moment (150 = 30 secs)ss
      start_load_time = Time.now
      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
        until @ie.readyState == READYSTATE_COMPLETE  do
          sleep a_moment
        end
        sleep a_moment
        until @ie.document do
          sleep a_moment
        end

        documents_to_wait_for = [EMAIL PROTECTED]
      rescue WIN32OLERuntimeError # IE window must have been closed
        @down_load_time = Time.now - start_load_time
        sleep @pause_after_wait unless no_sleep
        return @down_load_time
      end

      while doc = documents_to_wait_for.shift
        begin
          until doc.readyState == "complete" do
            sleep a_moment
          end
          @url_list << doc.url unless @url_list.include?
(doc.location.href)
          doc.frames.length.times do |n|
            begin
              documents_to_wait_for << doc.frames[n.to_s].document
            rescue WIN32OLERuntimeError
            end
          end
        rescue WIN32OLERuntimeError
        end
      end

      @down_load_time = Time.now - start_load_time
      run_error_checks
      sleep @pause_after_wait unless no_sleep
      @down_load_time
    end

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


    end
  end
end

Try this and let me know if it helps....

-Tony
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To post to this group, send email to watir-general@googlegroups.com
Before posting, please read the following guidelines: 
http://wiki.openqa.org/display/WTR/Support
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/watir-general
-~----------~----~----~----~------~----~------~--~---

Reply via email to