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

Support w3c for latest chrome / chromedriver releases

maryolivier opened this issue · comments

Background

As of now, I need to disable w3c mode within my passed in chromeOptions in order to avoid errors that occur when I use .send_keys(). It seems that the latest versions of chrome/chromedriver do not support command sendKeysToActiveElement. I'm going to start here: https://chromium.googlesource.com/chromium/src/+/master/docs/chromedriver_status and see if i can submit a PR for this.

Workaround

(not sure how long this will last so I'd like to fix as soon as possible)

  • When starting hound session, include "w3c" => false option within chromeOptions map.
      Hound.start_session(
        metadata: metadata,
        additional_capabilities: %{
          javascriptEnabled: true,
          chromeOptions: %{
            "args" => [
              "--user-agent=#{
                Hound.Browser.user_agent(:chrome) |> Hound.Metadata.append(metadata)
              }",
              "--headless",
              "--disable-gpu"
            ],
            "w3c" => false
          }
        }
      )

My thought is to make a new method called send_keys_to_element and leave the old method available until it's no longer needed at all.

Last year I was working on adding W3C WebDriver support to Wallaby, and while the work is not merged upstream yet (and I don't work with Wallaby much anymore so it's more likely to be implemented by someone else), I think it could be useful to anyone working on this.

Additionally, I know @aaronrenner is working on web_driver_client which aims to provide clients for all "WebDriver" protocols as well as a common interface to them - this also could be useful.