0

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 `'

orde
  • 5,233
  • 6
  • 31
  • 33
Ma St
  • 13
  • 3

1 Answers1

0

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.

Community
  • 1
  • 1
titusfortner
  • 4,099
  • 2
  • 15
  • 29
  • Actually, I tried both solutions, but they do not seem to work. I tried: Watir.default_timeout = 120 client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 180 # seconds – default is 60 Neither seem to work. If I am using Test:Unit where should I put this? In the setup or before setup section? – Ma St Jan 06 '15 at 15:40
  • Forgot to say that you need to remove the sleep. Webdriver will automatically wait for the page to load and the sleep you have set will wait in addition to that and cause problems. – titusfortner Jan 06 '15 at 19:38