简体   繁体   English

Ruby / Watir在使用“goto”后卡住了

[英]Ruby/Watir getting stuck after using “goto”

I'm using a simple browser.goto(url) call to our Microsoft SQL Reporting pages. 我正在使用一个简单的browser.goto(url)调用我们的Microsoft SQL报告页面。 It does a "goto" on the first url but then just sits there. 它在第一个网址上“goto”,但随后就坐在那里。 I'm currently running it via command line. 我目前正在通过命令行运行它。

If I Ctrl+C to cancel it, the output says: 如果我按Ctrl + C取消它,输出显示:

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. 所以,我猜测页面上的某些内容会导致Waitr问题。 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. 我想要它做的就是加载页面,在那里坐一段指定的时间,然后移动到下一个url(它用于电视屏幕),没什么复杂的。

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: 我尝试使用Timeout类包装它,即:

    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? 有没有人知道修复,或者如何覆盖Watir在执行goto时所做的隐式“等待”?

My guess would be that there is something on that page that keeps IE from saying "I'm done loading everything here". 我的猜测是该页面上有一些东西让IE不说“我已经完成了在这里加载所有内容”。

There is a $browser.click_no_wait command and a $browser.click! 有一个$ browser.click_no_wait命令和$ 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. 命令,所以如果你有一个静态页面,其中有一个链接到你的网址,你可以$ browser.goto那个页面和clcik_no_wait链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM