Wallabidi.Chrome (wallabidi v0.2.13)

Copy Markdown View Source

The Chrome driver uses chromedriver and WebDriver BiDi to control Chrome.

Usage

{:ok, session} = Wallabidi.start_session()

Configuration

Headless

Chrome will run in headless mode by default.

config :wallabidi,
  chromedriver: [
    headless: false
  ]

Capabilities

config :wallabidi,
  chromedriver: [
    capabilities: %{
      "goog:chromeOptions": %{args: ["--headless"]}
    }
  ]

ChromeDriver binary

config :wallabidi,
  chromedriver: [
    path: "path/to/chromedriver"
  ]

Chrome binary

config :wallabidi,
  chromedriver: [
    binary: "path/to/chrome"
  ]

Remote ChromeDriver

To connect to a ChromeDriver running in a separate container (e.g. Docker):

config :wallabidi,
  chromedriver: [
    remote_url: "http://chrome:4444/"
  ]

When remote_url is set, Wallabidi will not start a local ChromeDriver process and will instead connect to the remote instance.

Summary

Types

Options to pass to Wallabidi.start_session/1

Functions

Returns a specification to start this module under a supervisor.

Types

start_session_opts()

@type start_session_opts() ::
  {:capabilities, map()}
  | {:readiness_timeout, timeout()}
  | {:window_size, keyword()}
  | {:metadata, map()}

Options to pass to Wallabidi.start_session/1

  • :capabilities - capabilities to pass to chromedriver on session startup
  • :readiness_timeout - milliseconds to wait for chromedriver to be ready (default: 10000)
  • :window_size - initial window size as [width: w, height: h]
  • :metadata - beam metadata to append to user-agent

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.