HashNuke / hound

Elixir library for writing integration tests and browser automation
http://hexdocs.pm/hound
MIT License
1.36k stars 145 forks source link

navigate_to is not navigating but giving about:blank #183

Open ijunaid8989 opened 7 years ago

ijunaid8989 commented 7 years ago

my deps are

      {:hound, "~> 1.0"},
      {:floki, "~> 0.18.0"},
      {:httpoison, "~> 0.13.0"}

And I have started the phantomjs webdirver as

phantomjs --wd

In config file

config :hound, driver: "phantomjs"

and my module is

defmodule ThreeScrapper do
  @moduledoc """
  Documentation for ThreeScrapper.
  """
  use Hound.Helpers

  def start do
    IO.puts "starting"
    Hound.start_session
    navigate_to "https://login.three.ie"
    submit_element(el)
  end
end

My issue is: When I do any navigation, It dont navigate, for exampel I navigate_to "https://login.three.ie".. page source is 3 html tags and current url is about blank?

danhper commented 7 years ago

Hi, what version of Phantomjs are you using?

Kukunin commented 7 years ago

I have the same issue. My phantomjs 2.1.1

Kukunin commented 7 years ago

Was able to fix this issue. Hound doesn't run the server automatically, and if there is no server running, phantomjs returns 'about:blank'. Setting server: true in config/test.exs made phoenix starting the server on every mix test that fixed the problem.

yithanglee commented 6 years ago

yeah, im having issues navigating to these https sites. There's no problem with http sites.

danhper commented 6 years ago

Could you provide more information please? I am not able to reproduce the issue.

mbenatti commented 6 years ago

same here with https sites

mbenatti commented 6 years ago

Simple test:

  test "get https page" do
    navigate_to("https://www.google.com.br/") #I was testing the url https://sistemas.anac.gov.br/bav/FormConsultarVraInternet.do

    IO.inspect(current_url())
    IO.inspect(current_path())
    IO.inspect(page_title())

    assert page_title() == "Google"
  end

Output

$ mix test
."about:blank"
"blank"
""
...

Mix.lock

%{
  "certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm"},
  "hackney": {:hex, :hackney, "1.11.0", "4951ee019df102492dabba66a09e305f61919a8a183a7860236c0fde586134b6", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
  "hound": {:hex, :hound, "1.0.4", "31db3c013f0ed321b5eb4c573bf3fbc0b74e12fc8da134f9f616527bf0906431", [:mix], [{:hackney, "~> 1.5", [hex: :hackney, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
  "idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
  "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"},
  "mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm"},
  "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
  "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"},
  "unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm"},
}

Elixir 1.6.1 Erlang 20.2 Phantomjs 2.1.1

mbenatti commented 6 years ago

Just to update this, I solved changing phantomjs driver to chromedriver