[Wtr-general] Script non-responsive
Bret Pettichord
bret at pettichord.com
Sun Jul 31 16:17:26 EDT 2005
The way i read this thread, the problem is that IE#wait() doesn't return
until the page has stopped loading but the AOL page has continuously
loading frames. Correct?
Bret
At 01:03 PM 7/28/2005, Paul Rogers wrote:
>This page at aol has several iframes that get updated with the latest 'hot
>searches' My guess is that the problem is something to do with these.
>I altered the wait method, and I got my problm sorted - maybe you could try
>this and see if it works for you?
>
>Paul
> ## wait with a maximum wait time
>
>
>
>
># This method is used internally to cause an execution to stop until the
>page has loaded in Internet Explorer.
>def wait( noSleep = false )
> begin
> @down_load_time=0
> pageLoadStart = Time.now
> @pageHasReloaded= false
>
> s= Spinner.new(@enable_spinner)
> while @ie.busy
> @pageHasReloaded = true
> sleep 0.02
> s.spin
> end
> s.reverse
>
> #log "wait: readystate=" + @ie.readyState.to_s
> puts "wait: readystate=" + @ie.readyState.to_s
> @max_wait_time = 30 # seconds
> time_waited=0
> sleep_time = 0.02
>
> until @ie.readyState == READYSTATE_COMPLETE or time_waited >
>@max_wait_time
>
> @pageHasReloaded = true
> sleep sleep_time
> time_waited += sleep_time
> puts "Time waited so far: #{time_waited}"
>
> s.spin
> end
> sleep 0.02
>
> puts "wait: document.readystate=" + @ie.document.readyState.to_s
>
> until @ie.document.readyState == "complete" or time_waited >
>@max_wait_time
> sleep sleep_time
> time_waited += sleep_time
> puts "Time waited so far: #{time_waited}"
> s.spin
> end
>
>
> if @ie.document.frames.length > 1
> begin
> 0.upto @ie.document.frames.length-1 do |i|
> until @ie.document.frames[i.to_s].document.readyState ==
>"complete"
> sleep 0.02
> s.spin
> end
>
> @url_list << @ie.document.frames[i.to_s].document.url
>unless url_list.include?(@ie.document.frames[i.to_s].document.url)
> end
> rescue=>e
> @logger.warn 'frame error in wait' + e.to_s + "\n" +
>e.backtrace.join("\n")
> end
> else
> @url_list << @ie.document.url unless
>@url_list.include?(@ie.document.url)
> end
> @down_load_time = Time.now - pageLoadStart
>
> run_error_checks
>
> print "\b" unless @enable_spinner == false
>
> s=nil
> rescue WIN32OLERuntimeError => e
> @logger.warn 'runtime error in wait ' # + e.to_s
> end
> sleep 0.01
> sleep @defaultSleepTime unless noSleep == true
>end
>
>
>
>
>
>
>
>
>-----Original Message-----
>From: wtr-general-bounces at rubyforge.org
>[mailto:wtr-general-bounces at rubyforge.org]
>Sent: 28 July 2005 11:39
>To: wtr-general at rubyforge.org
>Subject: RE: [Wtr-general] Script non-responsive
>
>
>I just tried search.aol.com and I get a similar thing, even when attaching
>to it
>
>ie=Watir::IE.attach(:title , /S/)
>and it just hangs.
>Stack trace after a ctrl C
>
>IRB::Abort: abort then interrupt!!
> from c:/ruby/lib/ruby/1.8/irb.rb:81:in `irb_abort'
> from c:/ruby/lib/ruby/1.8/irb.rb:241:in `signal_handle'
> from c:/ruby/lib/ruby/1.8/irb.rb:66:in `start'
> from c:/ruby/lib/ruby/1.8/irb.rb:65:in `call'
> from ../watir.rb:1402:in `sleep'
> from ../watir.rb:1402:in `wait'
> from ../watir.rb:1113:in `attach_init'
> from ../watir.rb:1104:in `attach'
> from (irb):2
>
>I have some time now, so I'll take a look
>
>Paul
>
>-----Original Message-----
>From: Daniel Kurtz [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of
>Daniel Kurtz
>Sent: 27 July 2005 11:12
>To: wtr-general at rubyforge.org
>Subject: RE: [Wtr-general] Script non-responsive
>
>
>Actually, I hadn't even noticed the typo in your code <g>.
>
>In any event, the problem is not that Watir can't locate or click the
>button. The issue is that, once clicked, control never comes back to Watir
>from the page/browser, so the script hangs.
>
>
>Daniel Kurtz
>Consultant
>Olenick & Associates
>205 W. Wacker Drive
>Suite 2010
>Chicago, IL 60606
>312-332-0096
>www.olenick.com
>
> _____
>
>From: wtr-general-bounces at rubyforge.org on behalf of Peter Chau
>Sent: Wed 7/27/2005 11:55 AM
>To: wtr-general at rubyforge.org
>Subject: RE: [Wtr-general] Script non-responsive
>
>
>Sorry there was a typo on my part... try
>
>ie.image(:src, /searchbutton_5_0.gif/).click
>
>
>
>
>_______________________________________________
>Wtr-general mailing list
>Wtr-general at rubyforge.org
>http://rubyforge.org/mailman/listinfo/wtr-general
_____________________
Bret Pettichord
www.pettichord.com
More information about the Wtr-general
mailing list