0
votes

Issue: Our website is very slow in loading a page after you enter a user id and password. To counteract this, I tried to enter a "Sleep" statement, in addition to a wait_until_present method. The webpage loads usually after about 70 seconds, but I get a timeout after 60 seconds. Why would this occur if I have a 90 second sleep statement in addition to the default 60 seconds for "wait_until_present"?

Code in RB File:

Enter User ID and Password

@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

Wait until page loads

sleep(90)
@browser.b(:text => "You are now viewing info for 1st Global House").wait_until_present

Error:

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:inrbuf_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:inreadline' 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:inread_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:incatch' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1317:in transport_request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1294:inrequest' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1287:in block in request' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:746:instart' from 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:inresponse_for' from 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 C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ ebdriver/remote/http/common.rb:40:incall' 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:inexecute' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ ebdriver/remote/bridge.rb:375:in clickElement' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.44.0/lib/selenium/ ebdriver/common/element.rb:54:inclick' from createaccount.rb:40:in `'

1
The site takes 60+ seconds to load?orde

1 Answers

0
votes

Per the Ruby Bindings page, the Net::HTTP class from Ruby's standard library has a default timeout of 60 seconds between driver calls. You can increase this timeout based on this answer.