Open kennedc opened 7 years ago
Same error. phantomjs
2.1.1, Poison
2.2.0, Elixir
1.3.4.
Tried to install Hound
from master branch, didn't help.
2) test guest survey (Portal.SurveyTest)
test/integration/survey_test.exs:191
** (Poison.SyntaxError) Unexpected token: E
stacktrace:
(poison) lib/poison/parser.ex:56: Poison.Parser.parse!/2
(poison) lib/poison.ex:83: Poison.decode!/2
(hound) lib/hound/response_parser.ex:29: Hound.ResponseParser.parse/5
(hound) lib/hound/request_utils.ex:48: Hound.RequestUtils.handle_response/3
test/integration/survey_test.exs:220: (test)
Hi, thanks for reporting. I could not reproduce the issue. Could someone please provide a minimum code sample to reproduce this?
I'm running into the same issue and I'm able to reproduce on a clean phoenix application running phantomjs 2.1.1.
mix phx.new testing_hound
defp deps do
[{:phoenix, "~> 1.3.0-rc"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.6"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:hound, "~> 1.0"},
{:cowboy, "~> 1.0"}]
end
config :hound, driver: "phantomjs"
test/testing_hound/web/acceptance/test_homepage.exs
defmodule TestingHound.HoundTest do
use ExUnit.Case
use Hound.Helpers
hound_session()
test "works" do
navigate_to("/")
assert page_source() =~ "<h2>Welcome to Phoenix!</h2>"
end
test "doesn't work" do
navigate_to("/")
title = find_element(:css, "h2") |> visible_text()
assert title == "Welcome to Phoenix!"
end
end
1) test doesn't work (TestingHound.HoundTest)
test/testing_hound/web/acceptance/test_homepage.exs:12
** (Poison.SyntaxError) Unexpected token at position 0: E
stacktrace:
(poison) lib/poison/parser.ex:57: Poison.Parser.parse!/2
(poison) lib/poison.ex:83: Poison.decode!/2
(hound) lib/hound/response_parser.ex:29: Hound.ResponseParser.parse/5
(hound) lib/hound/request_utils.ex:48: Hound.RequestUtils.handle_response/3
(hound) lib/hound/helpers/page.ex:65: Hound.Helpers.Page.search_element/3
(hound) lib/hound/helpers/page.ex:48: Hound.Helpers.Page.find_element/3
test/testing_hound/web/acceptance/test_homepage.exs:14: (test)
Finished in 3.1 seconds
2 tests, 1 failure
[INFO - 2017-07-24T07:49:00.369Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 8e2f48c0-7044-11e7-89e8-431541cfc1a9
[ERROR - 2017-07-24T07:49:00.478Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:00.781Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:01.035Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:01.288Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:01.542Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:01.795Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:02.049Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:02.304Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:02.558Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:02.812Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
[ERROR - 2017-07-24T07:49:03.065Z] RouterReqHand - _handle.error - {"line":40,"stack":"get\n_find\n_locateElement\n_handleLocateCommand\n_handle\n_reroute\n_handle"}
If I comment out the "doesn't work" test and leave the one using just page_source() then the test will pass.
I've managed to reproduce without phoenix as well, which is quicker to get working, and I received the same outputs.
defp deps do
[{:hound, "~> 1.0"}]
end
config :hound, driver: "phantomjs"
defmodule TestHound do
use ExUnit.Case
use Hound.Helpers
hound_session()
test "works" do
navigate_to("https://elixir-lang.org/docs.html")
assert page_source() =~ "<h2 id=\"documentation\">Documentation</h2>"
end
test "doesn't work" do
navigate_to("https://elixir-lang.org/docs.html")
title = find_element(:css, "#documentation") |> visible_text()
assert title == "Documentation"
end
end
Having exactly the same issue than @kylethebaker, find_element/2 function seems to be the problem
I'm trying to get the current_url of a page with phantomjs
but calling current_url throws the error:
I'm running the following versions:
And i'm using config :hound, driver: "phantomjs"
page_source works as expected. any ideas?
Kenneth