View Source Playwright.SDK.Config (playwright v1.44.0-alpha.4)

Configuration for Playwright.

Overview

config :playwright, ConnectOptions,
  [...]

config :playwright, LaunchOptions,
  [...]

config :playwright, PlaywrightTest,
  [...]

Details for ConnectOptions

Configuration for connecting to a running Playwright browser server over a WebSocket.

ws_endpoint (required)

A browser websocket endpoint to which the runner will connect.

This option is required when using the :driver transport to communicate with a Playwright browser server.

e.g.,

config :playwright, ConnectOptions,
  ws_endpoint: "ws://localhost:3000/"

Details for LaunchOptions

Configuration for Playwright browser server launch commands.

args (optional)

Additional arguments to pass to the browser instance. The list of Chromium flags may be found online.

e.g.,

config :playwright, LaunchOptions,
  args: [
    "--use-fake-ui-for-media-stream",
    "--use-fake-device-for-media-stream"
  ]

channel (optional)

Browser distribution channel for Chromium. Supported values are:

  • chrome
  • chrome-beta
  • chrome-dev
  • chrome-canary
  • msedge
  • msedge-beta
  • msedge-dev
  • msedge-canary

Read more about using Google Chrome and Microsoft Edge online.

e.g.,

config :playwright, LaunchOptions,
  channel: "chrome"

chromium_sandbox (optional)

Enable Chromium sandboxing. Defaults to false.

e.g.,

config :playwright, LaunchOptions,
  chromium_sandbox: true

devtools (optional)

With Chromium, specifies whether to auto-open a "Developer Tools" panel for each tab. If this option is true, the headless option will be set to false.

Defaults to false.

e.g.,

config :playwright, LaunchOptions,
  devtools: true

headless (optional)

Specifies whether to run the browser in "headless" mode. See:

Defaults to true unless the devtools option is true.

e.g.,

config :playwright, LaunchOptions,
  headless: false # e.g., see a browser window pop up in "dev".

downloads_path (optional)

WARNING: not yet implemented

If specified, accepted downloads are written to this directory. Otherwise, a temporary directory is created and is removed when the browser is closed.

e.g.,

config :playwright, LaunchOptions,
  downloads_path: "./doc/downloads"

env (optional)

WARNING: not yet implemented

Environment variables that will be made visible to the browser. Defaults to System.get_env/0.

e.g.,

config :playwright, LaunchOptions,
  env: ["DEBUG", "true"]

executable_path (optional)

A filesystem path to a browser executable to run instead of the bundled browser. If executable_path is a relative path, then it is resolved relative to the current working directory.

Chromium-only

Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works best with the bundled version of Chromium. There is no guarantee that it will work with any other version.

Use executable_path option with extreme caution.

e.g.,

config :playwright, LaunchOptions,
  executable_path: "/Applications/..."

driver_path (optional)

A filesystem path to the playwright cli.js file to use instead of the default assets path.

Chromium-only

This can be helpful for packaged releases or systems where the node_module may be located elsewhere on the filesystem.

Use driver_path option with extreme caution.

e.g.,

config :playwright, ConnectOptions,
  driver_path: "/Cache/.../playwright/cli.js"

Details for PlaywrightTest

Configuration for usage of PlaywrightTest.Case.

transport (optional)

One of :driver or :websocket, defaults to :driver.

Additional configuration may be required depending on the transport configuration:

  • LaunchOptions for the :driver transport
  • ConnectOptions for the :websocket transport

e.g.,

config :playwright, PlaywrightTest,
  transport: :websocket