tags:

views:

218

answers:

2

I'm using a simple browser.goto(url) call to our Microsoft SQL Reporting pages. It does a "goto" on the first url but then just sits there. I'm currently running it via command line.

If I Ctrl+C to cancel it, the output says:

C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie-class.rb:506:in `wait': Interrupt
    from C:/Ruby/lib/ruby/gems/1.8/gems/watir-1.6.5/lib/watir/ie-class.rb:355:in `goto'
    from screen.rb:37:in `SqlReports'
    from screen.rb:35:in `each'
    from screen.rb:35:in `SqlReports'
    from screen.rb:45

So, I'm guessing something on the page is causing Waitr problems. I've googled the about snippets, but not come back with anything. All I want it to do is load the page, sit there for a specified time, then move to the next url (it's for a tv screen), nothing complex.

So I've tried placing a "begin/rescue" ie:

    begin
        $browser.goto(url)   
    rescue
    end

No luck, it just sits on the first url. And I've tried wrapping that using the Timeout class, ie:

    begin
        Timeout::timeout(30) do
            $browser.goto(url) 
        end
    rescue
    end

Still no luck, it crashes out. Does anyone know a fix, or how to override the implicit "wait" that Watir does when doing a goto?

+2  A: 

My guess would be that there is something on that page that keeps IE from saying "I'm done loading everything here".

There is a $browser.click_no_wait command and a $browser.click! command, so if you had a static page that had a link to your url, you could $browser.goto that page and clcik_no_wait the link.

mandersn
Not a direct fix, but a fix non the less. Cheers.
Bealer
+1  A: 

an excellent solution using timeouts at http://watirboy.blogspot.com/2010/07/watir-timeout-handle-browser-hangstuck.html

Thanks. That helped an automation script of mine, as well.
Santa