超时错误:
问题:在输入用户名和密码后,我们的网站在加载页面时速度很慢。 为了抵消这一点,除了wait_until_present方法之外,我尝试输入“睡眠”语句。 网页通常在大约70秒后加载,但是我在60秒后得到超时。 为什么会发生这种情况,除了“wait_until_present”的缺省60秒之外,还有90秒的睡眠声明?
RB文件中的代码:
输入用户名和密码
@browser.driver.find_element(id: "ctl00_ContentPlaceHolder1_Wizard1_txtUserName").send_keys ""
@browser.driver.find_element(name: "ctl00$$Wizard1$StartNavigationTemplateContainerID$btnNext").click
@browser.driver.find_element(id: "ctl00_ContentPlaceHolder1_Wizard1_txtPassword").send_keys ""
@browser.driver.find_element(name: "ctl00$$Wizard1$StepNavigationTemplateContainerID$btnNext").click
等到页面加载
sleep(90)
@browser.b(:text => "You are now viewing info for 1st Global House").wait_until_present
错误:
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:146:in rescue in rbuf_fill': Timeout::Error ( imeout::Error) from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:140:in
rbuf_fill'from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:122:in readuntil' from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:132:in
readline'from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2563:in read_status_line' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2552:in
read_new'from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1320:in block in transport_request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in
从C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317获得transport_request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1294:in
in transport_request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1294:in
从C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1287: block in request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:746:in
中的block in request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:746:in
从C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1285:in request' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ ebdriver/remote/http/default.rb:83:in
r esponse_for'从C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ebdriver/remote/http/default.rb:39:in request'from request' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ ebdriver/remote/http/common.rb:40:in
call'from C:/ Ruby193 / lib / ruby / gems / 1.9.1 / gems / selenium-webdriver-2.44.0 / lib / selenium / ebdriver / remote / bridge.rb:640:in raw_execute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ ebdriver/remote/bridge.rb:618:in
execute'from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver- 2.44.0 / lib / selenium / ebdriver / remote / bridge.rb:375:在clickElement' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ ebdriver/common/element.rb:54:in
点击'from createaccount.rb:40:in''
根据Ruby绑定页面,来自Ruby标准库的Net :: HTTP类在驱动程序调用之间的默认超时时间为60秒。 您可以根据此答案增加此超时时间。
链接地址: http://www.djcxy.com/p/38775.html上一篇: Timeout:Error
下一篇: ruby