Selenium Ruby - Can't run the start example (linux) - ruby

I want use Selenium with Ruby. I'm on a Ubuntu 15.10
First, I've installed the selenium-webdriver gem.
Now I'm trying to execute the example code:
require "selenium-webdriver"
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://google.com"
element = driver.find_element(:name, 'q')
element.send_keys "Hello WebDriver!"
element.submit
puts driver.title
driver.quit
When I do so I get this error:
/home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in `read_nonblock': end of file reached (EOFError)
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:153:in `rbuf_fill'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:134:in `readuntil'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/protocol.rb:144:in `readline'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/response.rb:39:in `read_status_line'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/response.rb:28:in `read_new'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1414:in `block in transport_request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `catch'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1411:in `transport_request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1384:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1377:in `block in request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:853:in `start'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:1375:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:107:in `response_for'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/default.rb:58:in `request'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/http/common.rb:59:in `call'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:649:in `raw_execute'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:627:in `execute'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/remote/bridge.rb:134:in `get'
from /home/my_user/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.4/lib/selenium/webdriver/common/navigation.rb:33:in `to'
When executed, a Firefox window is opened and closed instantaneously (before the driver.quit).

Related

Net::ReadTimeout Error when Watir::Browser.new

I'm trying to start watir browser,
irb(main):001:0> require 'watir'
=> true
irb(main):002:0> browser = Watir::Browser.new
Watir opens a new chrome browser with data:,wrote in the search bar. After 60 seconds of waiting, the browser just closes, and I'm getting this error in console:
Net::ReadTimeout: Net::ReadTimeout
from /usr/lib/ruby/2.3.0/net/protocol.rb:158:in `rbuf_fill'
from /usr/lib/ruby/2.3.0/net/protocol.rb:136:in `readuntil'
from /usr/lib/ruby/2.3.0/net/protocol.rb:146:in `readline'
from /usr/lib/ruby/2.3.0/net/http/response.rb:40:in `read_status_line'
from /usr/lib/ruby/2.3.0/net/http/response.rb:29:in `read_new'
from /usr/lib/ruby/2.3.0/net/http.rb:1437:in `block in transport_request'
from /usr/lib/ruby/2.3.0/net/http.rb:1434:in `catch'
from /usr/lib/ruby/2.3.0/net/http.rb:1434:in `transport_request'
from /usr/lib/ruby/2.3.0/net/http.rb:1407:in `request'
from /usr/lib/ruby/2.3.0/net/http.rb:1400:in `block in request'
from /usr/lib/ruby/2.3.0/net/http.rb:853:in `start'
from /usr/lib/ruby/2.3.0/net/http.rb:1398:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/default.rb:121:in `response_for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/default.rb:76:in `request'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/http/common.rb:62:in `call'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/bridge.rb:164:in `execute'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/bridge.rb:97:in `create_session'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/remote/bridge.rb:53:in `handshake'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/chrome/driver.rb:48:in `initialize'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/common/driver.rb:44:in `new'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver/common/driver.rb:44:in `for'
from /var/lib/gems/2.3.0/gems/selenium-webdriver-3.14.0/lib/selenium/webdriver.rb:86:in `for'
from /var/lib/gems/2.3.0/gems/watir-6.13.0/lib/watir/browser.rb:48:in `initialize'
from (irb):3:in `new'
from (irb):3
from /usr/bin/irb:11:in `<main>'
How could I solve this issue?
watir 6.19.0+
As of watir version 6.19.0, they provide their own HTTPClient so you can just do something like this:
Watir::Browser.new :firefox, http_client: { read_timeout: 120 }
As you said this happens when page load exceeds 60 seconds, you can increase the page load timeout by the following code
client = Selenium::WebDriver::Remote::Http::Default.new
client.read_timeout = 120 # seconds
driver = Selenium::WebDriver.for :firefox,http_client: client
b=Watir::Browser.new driver
Now your code would wait for 120 seconds for any page load which has been caused by #click and also wait to load the url by goto method.

Timeout::Error with Selenium/Capybara/Cucumber/Ruby

We are facing issue when we are executing the scenarios in cucumber ruby using Capybara. After few Scenarios are executed, we are getting time out error and not able to proceed to next scenario.
Following error is displayed
Timeout::Error (Timeout::Error)
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:146:in `rescue in rbuf_fill'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:122:in `readuntil'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/protocol.rb:132:in `readline'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:2563:in `read_status_line'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:2552:in `read_new'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1320:in `block in transport_request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1317:in `catch'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1317:in `transport_request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1294:in `request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1287:in `block in request'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:746:in `start'
/usr/local/rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1285:in `request'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/bridge.rb:634:in `raw_execute'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/bridge.rb:612:in `execute'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/remote/bridge.rb:361:in `deleteAllCookies'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/selenium-webdriver-2.37.0/lib/selenium/webdriver/common/options.rb:67:in `delete_all_cookies'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara/selenium/driver.rb:84:in `reset!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara/session.rb:77:in `reset!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara.rb:245:in `block in reset_sessions!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara.rb:245:in `each'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara.rb:245:in `reset_sessions!'
/usr/local/rvm/gems/ruby-1.9.3-p448/gems/capybara-2.1.0/lib/capybara/cucumber.rb:10:in `After'
We are using Capybara 2.1.0 version and Cucumber 1.3.8.
Any ideas would be greatly appreciated!

Watir tests fail when running in background under windows 8

I'm running Watir tests in firefox using a jenkins slave installed as service under windows 8 in virtual box.
Testcases include two tests. When I run them manually, everything is fine. When jenkins runs them, the first test always succeeds, and the second always fails with exception:Net::ReadTimeout: Net::ReadTimeout.
I have tried different combinations of test code and begin/rescue blocks, but everytime the exception is caused by browser object methods:
#browser.goto
#browser.execute_script
#browser.wait_until_present
#browser.close
...
Setup and teardown are:
def teardown
#browser.close
end
def setup
profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension #extension_path
#browser = Watir::Browser.new :firefox, :profile => profile
end
gems versions:
watir (4.0.2)
selenium-webdriver (2.33.0)
I have also tried to run service under system account with desktop interaction enabled and under local user account.
One of error logs:
> Net::ReadTimeout: Net::ReadTimeout
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:158:in `rescue in rbuf_fill'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:152:in `rbuf_fill'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:134:in `readuntil'
C:/Ruby200-x64/lib/ruby/2.0.0/net/protocol.rb:144:in `readline'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http/response.rb:39:in `read_status_line'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http/response.rb:28:in `read_new'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1406:in `block in transport_request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1403:in `catch'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1403:in `transport_request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1376:in `request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1369:in `block in request'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:852:in `start'
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1367:in `request'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:83:in `response_for'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/default.rb:39:in `request'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:629:in `raw_execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:607:in `execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/remote/bridge.rb:195:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/firefox/bridge.rb:55:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.33.0/lib/selenium/webdriver/common/driver.rb:168:in `quit'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.6.4/lib/watir-webdriver/browser.rb:135:in `close'
C:/jenkins/workspace/tests_matrix/TEST_BROWSER/firefox/TEST_OS/windows8/build_script_win/tests/test_case2.rb:173:in `teardown'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1316:in `block in run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1314:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1314:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:655:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
C:/Ruby200-x64/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:21:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:774:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:834:in `run'
C:/Ruby200-x64/lib/ruby/2.0.0/test/unit.rb:838:in `run'
C:/Users/test/AppData/Local/Temp/hudson2953103359547849695.sh:4:in `<main>'
I run into the Net::ReadTimeout error, too, and tried hard to fix it by refresh the browser after catching the Net::ReadTimeout error, like this:
begin
#browser.goto WEBSITE
rescue Net::ReadTimeout
#browser.refresh
sleep 1 unless #browser.ready_state == "complete"
end
I think if you post the test case code, maybe it will help to reach the solution.

Watir Webdriver ECONNRESET errors

I am getting this error
C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141:in `read_nonblock': An existing connection was forcibly closed by the remote host. (Errno::ECONNRESET)
from C:/Ruby193/lib/ruby/1.9.1/net/protocol.rb:141: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:2562:in `read_status_line'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2551:in `read_new'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1319:in `block in transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `catch'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1316:in `transport_request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1293:in `request'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:1064:in `head'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/service.rb:63:in `block in stop'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:745:in `start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:557:in `start'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/service.rb:59:in `stop'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/chrome/bridge.rb:50:in `quit'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.24.0/lib/selenium/webdriver/common/driver.rb:166:in `quit'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:87:in `close'
from test_google.rb:9:in `block in <main>'
from test_google.rb:5:in `times'
from test_google.rb:5:in `<main>'
whenever I run tests successively. I believe it is a webdriver/selenium bug, but would like if someone could help me fix or determine the cause.
Here is some code you can try running in irb:
20.times { b = Watir::Browser.new :chrome; b.goto "http://google.com"; p b.div.exists?; b.close;}
EDIT: I updated my ChromeDriver and do not receive the error for the above code.
In order to fix this try updating your Chrome Driver: http://code.google.com/p/chromedriver/downloads/list

'rescue in rbuf_fill': Timeout::Error (Timeout::Error)

Same script different error. This might be related more to my network instead of my code. The script is as follows:
#!/usr/bin/env ruby -rubygems
require File.join(File.dirname(__FILE__), 'authentication')
require "csv" # faster_csv (ruby 1.9)
lines = CSV.read(File.join(File.dirname(__FILE__), 'karaoke.csv')) # Exported an Excel file as CSV
lines.slice!(0) # remove header line
collection = StorageRoom::Collection.find('collection ID')
Song = collection.entry_class
lines.each do |row|
karaoke = Song.new(:artist => row[0], :song => row[1], :genre => row[2], :file => StorageRoom::File.new_with_filename("#{karaoke.artist}#{karaoke.song}.mov"))
if karaoke.save
puts "Song saved: #{karaoke.artist}, #{karaoke.song}, #{karaoke.genre}"
else
puts "Song could not be saved: #{karaoke.errors.join(', ')}"
end
end
And the error is:
/usr/local/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill': Timeout::Error (Timeout::Error)
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:134:in `rbuf_fill'
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil'
from /usr/local/lib/ruby/1.9.1/net/protocol.rb:126:in `readline'
from /usr/local/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line'
from /usr/local/lib/ruby/1.9.1/net/http.rb:2208:in `read_new'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1177:in `request'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1170:in `block in request'
from /usr/local/lib/ruby/1.9.1/net/http.rb:627:in `start'
from /usr/local/lib/ruby/1.9.1/net/http.rb:1168:in `request'
from /usr/local/lib/ruby/gems/1.9.1/gems/httparty-0.8.1/lib/httparty/request.rb:73:in `perform'
from /usr/local/lib/ruby/gems/1.9.1/gems/httparty-0.8.1/lib/httparty.rb:391:in `perform_request'
from /usr/local/lib/ruby/gems/1.9.1/gems/httparty-0.8.1/lib/httparty.rb:359:in `post'
from /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:69:in `block (2 levels) in create'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:403:in `_run__3801264735883484179__create__2558870880708463764__callbacks'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
from /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:68:in `block in create'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:403:in `_run__3801264735883484179__save__2558870880708463764__callbacks'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
from /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:67:in `create'
from /home/hanleyhansen/Desktop/thriventures-storage_room_gem-f7015ed/lib/storage_room/model.rb:61:in `save'
from import_csv.rb:17:in `block in <main>'
from import_csv.rb:14:in `each'
from import_csv.rb:14:in `<main>'
I'm interested in learning why this error occurred as well as the solution. Thanks in advance!
Found this while perusing the web. Hopes it helps somebody! Setting a longer timeout
Here is how you can adjust the timeout in the Net::HTTP API:
require 'net/http'
http = Net::HTTP.new(#host, #port)
http.read_timeout = 500

Resources