elixir-wallaby/wallaby

UndefinedFunctionError: :chrome.validate/0 is undefined (module :chrome is not available)

Closed this issue · 7 comments

Issue

I installed Wallaby (0.24.1) as described. We wanted to switch from phantomjs to chromedriver but got the appended error after applying driver: :chrome to the config.

The given System runs

  • Ubuntu 20.04 LTS
  • Erlang/OTP 23 [erts-11.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]
  • Elixir 1.10.3 (compiled with Erlang/OTP 21)
  • ChromeDriver 83.0.4103.61 (94f915a8d7c408b09cc7352161ad592299f384d2-refs/branch-heads/4103@{#561})

It may be worth to mention that Ubuntu moved the previous chromium-driver package to chromium snap. However, chromium is available from commandline.

Any hint how to fix this would be wonderful! Thank you!

Log Output

18:16:33.768 [info] Application wallaby exited: exited in: Wallaby.start(:normal, [])
    ** (EXIT) an exception was raised:
        ** (UndefinedFunctionError) function :chrome.validate/0 is undefined (module :chrome is not available)
            :chrome.validate()
            (wallaby 0.24.1) lib/wallaby.ex:31: Wallaby.start/2
            (kernel 7.0) application_master.erl:277: :application_master.start_it_old/4
18:16:33.768 [info] Application web_driver_client exited: :stopped
18:16:33.768 [info] Application httpoison exited: :stopped
18:16:33.769 [info] Application poolboy exited: :stopped
** (MatchError) no match of right hand side value: {:error, {:wallaby, {:bad_return, {{Wallaby, :start, [:normal, []]}, {:EXIT, {:undef, [{:chrome, :validate, [], []}, {Wallaby, :start, 2, [file: 'lib/wallaby.ex', line: 31]}, {:application_master, :start_it_old, 4, [file: 'application_master.erl', line: 277]}]}}}}}}

@florianb I think the driver: config expects a module. Can you try Wallaby.Chrome as mentioned in the Readme?

@michallepicki - thank you very much, unfortunately the same result.

@florianb do you mind sharing your actual config?

Absolutely not! I'm happy to help.

config/test.exs

use Mix.Config

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :my_app, MyAppWeb.Endpoint,
  http: [port: 4002],
  server: true

# Print only warnings and errors during test
config :logger, level: :debug

config :wallaby,
  base_url: "http://localhost:4002",
  driver: Wallaby.Chrome

# Avoid timeout of assert_value
config :ex_unit, timeout: :infinity

# Provide initial credentials for CouchDb
config :my_app, :couchdb,
  username: "admin",
  password: "admin"

config/config.exs

# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.

# General application configuration
use Mix.Config

# Configures the endpoint
config :my_app, MyAppWeb.Endpoint,
  url: [host: "localhost"],
  secret_key_base: "snip",
  render_errors: [view: MyAppWeb.ErrorView, accepts: ~w(html json)],
  pubsub_server: MyApp.PubSub,
  live_view: [signing_salt: "snip"]

# Configures Elixir's Logger
config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id]

# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"

test/test_helper.exs

{:ok, _} = Application.ensure_all_started(:wallaby)
ExUnit.start()

No idea if the mix.exsis of interest, but i guess there's nothing special in it.

Oh, sorry I know the problem.

The readme is currently showing what is on master. Please set your driver to Wallaby.Experimental.Chrome.

Oh thank you very much @mhanberg - that fixed it.
Hopefully i'm soon able to give something back for your work! Let me know if you need a helping hand (even though i'm pretty new to the Elixir world and Wallaby).