elixir-wallaby/wallaby

Getting Selenium (Firefox & Safari) working in Wallaby (~> 0.30.x)

foucist opened this issue · 1 comments

I just wanted to share how I got Selenium working in Wallaby, as there seems to be some missing install instructions.

Firstly, it appears that Selenium version 4.8.3 is required, which I eventually figured out thanks to @matthewbrown48's hint. I originally tried brew install selenium-server which installed 4.22.0, but the wallaby tests ended up failing with (RuntimeError) Wallaby had an internal issue with HTTPoison: %HTTPoison.Error{id: nil, reason: :timeout}.

I downloaded selenium-server-4.8.3.jar. Which can be run like so: /homebrew/opt/openjdk/bin/java -jar ~/Downloads/selenium-server-4.8.3.jar standalone

my config/test.exs:

config :wallaby,
  driver: Wallaby.Selenium,
  selenium: [
    capabilities: %{
      browserName: "firefox", # browserName: "safari",
      "moz:firefoxOptions": %{
        args: ["-headless"]
      }
    }
  ]

For safari, there is no headless mode which is a bit disconcerting 😆. I was able to get it working by enabling it and running it as root.

   $ sudo su -
   $ safaridriver --enable
   $ safaridriver -p 0

probably should've put this in a discussion