Calabash always logging Errno::ECONNREFUSED - ruby

I am trying to run a calabash script on iOS but continually getting the following errors:
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (http://localhost:37265))
Retrying.. Errno::ECONNREFUSED: (Connection refused - connect(2) (http://localhost:37265))
Failing... Errno::ECONNREFUSED
Given I am on the homepage # features/step_definitions/homepage_steps.rb:6
Connection refused - connect(2) (http://localhost:37265) (Errno::ECONNREFUSED)
./features/PageObjects/home_page.rb:12:in `initialize'
./features/step_definitions/homepage_steps.rb:7:in `new'
./features/step_definitions/homepage_steps.rb:7:in `/^I am on the homepage$/'
features/general.feature:9:in `Given I am on the homepage'
Anyone have any suggestions on fixing this error?

I don't know if you are running on iOS or Android.
Running on Android, this can be caused by the device disconnecting from USB (unstable USB connection), or becoming invisible to ADB in some other way.

In this instance I fixed this by commenting ount 'APP_BUNDLE_PATH' within 01_launch.rb file. All working now.
So looks like the path to the APP_BUNDLE_PATH was set incorrectly. Hopefully this answer might help others.

Related

Pusher not able to establish connection

I'm trying to connect to the Liquid exchange's Stream API with pusher. Documentation here
I have constructed a function that is in line with the Pusher library's documentation. Link to that here
My current code looks like this:
require 'pusher-client'
channels_client = PusherClient::Socket.new('LIQUID', {
ws_host: 'tap.liquid.com'
})
and running that gives me an error message of:
D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding
pusher:connection_established to pusher_global_channel
D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding
pusher:connection_disconnected to pusher_global_channel
D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding pusher:error
to pusher_global_channel
D, [2019-08-20Txx:xx:xx.xxxxxx #xxxxx] DEBUG -- : Binding pusher:ping
to pusher_global_channel
If I try to run this after the first command:
channels_client.connect
...it refuses to connect.
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/pusher-client-0.6.2/lib/pusher-client/websocket.rb:17:in
`initialize': No connection could be made because the target machine
actively refused it. - connect(2) for "tap.liquid.com" port 80
(Errno::ECONNREFUSED)
The error comes from tcpsocket.new (Ruby https://ruby-doc.org/stdlib-2.5.1/libdoc/socket/rdoc/TCPSocket.html) in websocket line 17: https://github.com/pusher-community/pusher-websocket-ruby/blob/master/lib/pusher-client/websocket.rb
ws_host tap.liquid.com 80 seems to be invalid, https://pusher.com/docs/channels/library_auth_reference/pusher-websockets-protocol
I have tried using a secure connection, at least in the browser and got a 404 for ws and invalid request, which is good in this case, for https (https://tap.liquid.com/).
You need to configure ssl in the client configuration, but the pusher-client gem as well as one other I have found are pretty old. Maybe it is wise to switch to a more up-to-date library like https://github.com/pusher/pusher-http-ruby/blob/master/README.md
The example contains an option for activated SSL.

ECONNRESET error when accessing Ruby application which runs in Webrick

I am trying to install redmine (bugtracker which runs on ruby). I use webrick, it starts all fine, but when I access http://IP:3000/, it throws the following error in the server logs and the page does not load in the browser.
ERROR Errno::ECONNRESET: Connection reset by peer # io_fillbuf - fd:11
/root/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:82:in `eof?'
/root/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/httpserver.rb:82:in `run'
/root/.rbenv/versions/2.5.1/lib/ruby/2.5.0/webrick/server.rb:307:in `block in start_thread'
I am a bit stuck here, any help would be greatly appreciated.
Thanks in advance.
In the end, it was due to the port 3000 was being blocked by the network where the server was part of. Once the port block was removed, it started to work. Thanks #mike-k for your tips.

unable to execute the ruby Watir script, empty browser instance is opened and the below error is thrown

unable to execute the ruby Watir script, empty browser instance is opened and the below error is thrown.
ERROR:
C:\watir>ruby DevStageCompareNew.rb
C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:878:in
initialize: No connection could be made because the target machine actively refused it. - connect(2) (Errno::
ECONNREFUSED)
from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:878:in open
from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:878:in block in connect
from C:/Ruby200-x64/lib/ruby/2.0.0/timeout.rb:52:in timeout
from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:877:in connect
from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:862:in do_start
from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:851:in start
from C:/Ruby200-x64/lib/ruby/2.0.0/net/http.rb:1367:in request
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/http/default.rb:83:in response_for
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/http/default.rb:39:in request
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/http/common.rb:40:in call
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/bridge.rb:640:in raw_execute
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/bridge.rb:101:in create_session
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/remote/bridge.rb:68:in initialize
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/chrome/bridge.rb:29:in initialize
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/common/driver.rb:37:in new
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver/common/driver.rb:37:in for
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/selenium-webdriver-2.45.0/lib/selenium/webdriver.rb:67:in for
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/watir-webdriver-0.7.0/lib/watir-webdriver/browser.rb:46:in initialize
from DevStageCompareNew.rb:4:in new
from DevStageCompareNew.rb:4:in <main>
can someone help to resolve this..

Why is Net::HTTP.get_response throwing an error Errno::ECONNREFUSED: Connection refused - connect(2)?

I am trying to make a HTTP request using Capybara. When I attempt to execute the code below:
Net::HTTP.get_response(uri)
I get an error:
Errno::ECONNREFUSED: Connection refused - connect(2)
When I try the URI passed into the method explicitly it works perfectly. URL is an absolute address to the localhost starting with http://.
I don't know what I am doing wrong.

ERROR: My Regression suite was working before, but after I carried out a gem update and updated Firefox to 13.0 Error is occuring

The error that I keep on receiving when running a regression uite, can someone please shed some light on this. It's driving me crazy.
No connection could be made because the target machine actively
refused it. - connect(2) (Errno::ECONNREFUSED)
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:in initialize'
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:inopen'
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:in connect'
C:/Ruby187/lib/ruby/1.8/timeout.rb:53:intimeout'
C:/Ruby187/lib/ruby/1.8/timeout.rb:101:in timeout'
C:/Ruby187/lib/ruby/1.8/net/http.rb:560:inconnect'
C:/Ruby187/lib/ruby/1.8/net/http.rb:553:in do_start'
C:/Ruby187/lib/ruby/1.8/net/http.rb:542:instart'
C:/Ruby187/lib/ruby/1.8/net/http.rb:1035:in request'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/default.rb:76:in
response_for'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/default.rb:38:in
request'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/http/common.rb:40:in
call'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:598:in
raw_execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:576:in
execute'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/remote/bridge.rb:189:in
quit'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/firefox/bridge.rb:43:in
quit'
C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.22.2/lib/selenium/webdriver/common/driver.rb:166:in
quit'
C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:87:in
close'
Firefox 13 requires selenium-webdriver >= 2.23.0. Update it and it'll work correctly.

Resources