Я запустил новый проект и настроил его так:
mix new example
cd example
Я опустошил «lib / example.ex» и поместил туда следующий код:
Application.start :hound
defmodule Example do
use Hound.Helpers
def run do
Hound.start_session
navigate_to "http://akash.im"
IO.inspect page_title()
# Automatically invoked if the session owner process crashes
Hound.end_session
end
end
Example.run
Этопример кода, представленный на https://github.com/HashNuke/hound/blob/master/notes/simple-browser-automation.md
Затем я установил сервер Selenium через brew install selenium-server-standalone
(я на MacOS), запустил его через brew services start selenium-server-standalone
и добавил config :hound, driver: "selenium"
к config/config.exs
Я добавил Application.ensure_all_started(:hound)
в качестве первой строки test/test_helper.exs
.
Наконец, я добавил {:hound, "~> 1.0"}
к mix.exs и запустил mix test
.Вот когда я получаю следующую ошибку компиляции:
localhost:example alex$ mix test
===> Compiling parse_trans
===> Compiling mimerl
===> Compiling metrics
===> Compiling unicode_util_compat
===> Compiling idna
==> jason
Compiling 8 files (.ex)
Generated jason app
==> ssl_verify_fun
Compiling 7 files (.erl)
Generated ssl_verify_fun app
===> Compiling certifi
===> Compiling hackney
==> hound
Compiling 37 files (.ex)
Generated hound app
==> example
Compiling 1 file (.ex)
== Compilation error in file lib/example.ex ==
** (ArgumentError) argument error
(stdlib) :ets.lookup(Hound.SessionServer, #PID<0.592.0>)
(hound) lib/hound/session_server.ex:19: Hound.SessionServer.current_session_id/1
(hound) lib/hound/session_server.ex:13: Hound.SessionServer.session_for_pid/2
lib/example.ex:7: Example.run/0
localhost:example alex$ mix test
Compiling 1 file (.ex)
== Compilation error in file lib/example.ex ==
** (ArgumentError) argument error
(stdlib) :ets.lookup(Hound.SessionServer, #PID<0.160.0>)
(hound) lib/hound/session_server.ex:19: Hound.SessionServer.current_session_id/1
(hound) lib/hound/session_server.ex:13: Hound.SessionServer.session_for_pid/2
lib/example.ex:7: Example.run/0
Я забыл какой-то шаг или неправильно настроил что-то?Любая помощь очень ценится, спасибо!