HashNuke / hound

Elixir library for writing integration tests and browser automation

Home Page:http://hexdocs.pm/hound

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not transform value %{"element-6066-11e4-a52e-4f735466cecf" => "d2c5deba-fdff-48db-b319-694aa6542c81"} to element

maryolivier opened this issue · comments

Background

Using the latest Chrome 76.0.3809.87 and ChromeDriver 76.0.3809.68 with the latest Selenium 3.141.59. I can do things like navigate_to() and visible_in_page?() but cannot interact with the elements on the page, due to the error. I did some comparison between the applied additional_capabilities using the latest selenium version vs. the version that works for me (2.49; anything above this produces the error), and the only difference is that platform="ANY" is applied automatically in the version that works for me. I have tried adding platform="ANY" to the capabilities (as shown below), but it doesnt seem to be applied. Nevertheless, I am at a standstill and it seems to be a Hound related failure.

Config

test.exs:

config :hound,
  driver: "selenium",
  browser: "chrome_headless",
  app_port: 4001,
  genserver_timeout: 480_000

integration_case (setup file):

setup tags do
    :ok = Ecto.Adapters.SQL.Sandbox.checkout(App.Repo)
    metadata = Phoenix.Ecto.SQL.Sandbox.metadata_for(App.Repo, self())

    unless tags[:async] do
      Ecto.Adapters.SQL.Sandbox.mode(App.Repo, {:shared, self()})
    end

    Hound.start_session(
      additional_capabilities: %{
        browserName: "chrome",
        version: "76.0.3809.87",
        platform: "ANY",
        javascriptEnabled: true,
        chromeOptions: %{
          "args" => [
            "--user-agent=#{Hound.Browser.user_agent(:chrome) |> Hound.Metadata.append(metadata)}",
            "--disable-gpu",
            "--window-size=2000x1125"
          ]
        }
      }
    )

    navigate_to("/")

    parent = self()
    on_exit fn-> Hound.end_session(parent) end
    :ok
  end

Error

Upon running a function like this (searching for elements on the page):

parent_object =
      :class
      |> find_all_elements("InputLabel")
      |> Enum.find(&String.contains?(inner_html(&1), ~s(#{label})))

find_within_element(parent_object, :class, "Input")

I receive this error:

** (Hound.InvalidElementError) Could not transform value %{"element-6066-11e4-a52e-4f735466cecf" => "d2c5deba-fdff-48db-b319-694aa6542c81"} to element

this seems to be fixed in the latest code from master, closing this.

hi, any plans when a released version with this fix will appear in hex?