hound icon indicating copy to clipboard operation
hound copied to clipboard

Getting connection refused.

Open lowks opened this issue 7 years ago • 5 comments

I am trying to setup hound to run for my project. In mix.exs I added the dependencies:

{:hound, "~> 1.0"}

My config/test.exs looks like this:

+config :hound, driver: "phantomjs"

My test looks like this:

defmodule BasicBrowserSessionTest do
  use ExUnit.Case
  use Hound.Helpers

  hound_session

  test "Basic test." do
    url1 = "http://www.abc.com"
    navigate_to(url1)  
  end
end

The error I get:

BasicBrowserSessionTest
  * test Basic Test. (1057.3ms)
03:36:08.360 [error] GenServer Hound.SessionServer terminating
** (RuntimeError) could not create a new session: econnrefused, check webdriver is running
    (hound) lib/hound/session_server.ex:101: Hound.SessionServer.create_session/2
    (hound) lib/hound/session_server.ex:78: Hound.SessionServer.handle_call/3
    (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:665: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.598.0>): {:change_session, #PID<0.598.0>, :default, []}

My test_helper.exs

Application.ensure_all_started(:hound)
{:ok, _} = Application.ensure_all_started(:ex_machina)
ExUnit.start()
Ecto.Adapters.SQL.Sandbox.mode(UrboxApi.Repo, :manual)

I run phantomjs in another session by issuing the command phantomjs --wd

Can someone let me know what I am missing here ?

lowks avatar Jun 25 '18 03:06 lowks

I'm having the same problem here. I mean I'm not pretty sure if it's a issue or if it's the way that supposed to be!

CaioPenhalver avatar Oct 19 '18 00:10 CaioPenhalver

Have you tried configuring the webdriver port?

config :hound,
  driver: "phantomjs",
  host: "http://localhost",
  port: 8910
phantomjs --webdriver=127.0.0.1:8910

onelesd avatar Oct 23 '18 17:10 onelesd

I have this issue with chromedriver any recommendations? @HashNuke

JGjumpshot avatar Jan 20 '20 18:01 JGjumpshot

@JGjumpshot I may be remembering incorrectly, but I think chromedriver (thru homebrew) used to be managed thru brew services (and may have started automatically even?), but that appears to have changed so you probably manually need to start it.

You may need to configure the port, per the earlier comment, and start the chromedriver with chromedriver (assuming it's on your path). When you start it, it will output which port it's running on (you can also specify via chromedriver options when you start it)

jaydorsey avatar Jan 28 '20 05:01 jaydorsey

If you installed chromedriver via brew, you need to execute /usr/local/bin/chromedriver or the output of which chromedriver

philippneugebauer avatar Nov 14 '21 23:11 philippneugebauer