PlaywrightEx.BrowserType (PlaywrightEx v0.9.0)

Copy Markdown View Source

Interact with a Playwright BrowserType.

There is no official documentation, since this is considered Playwright internal.

Reference: https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/client/browserType.ts

Summary

Functions

Launches a new browser instance.

Types

guid()

@type guid() :: String.t()

launch_opt()

@type launch_opt() ::
  {:connection, GenServer.name()}
  | {:timeout, timeout()}
  | {:channel, binary()}
  | {:args, [binary()]}
  | {:executable_path, binary()}
  | {:ignore_all_default_args, boolean()}
  | {:ignore_default_args, [binary()]}
  | {:handle_sigint, boolean()}
  | {:handle_sigterm, boolean()}
  | {:handle_sighup, boolean()}
  | {:env, %{optional(atom() | binary()) => term()} | [map()]}
  | {:headless, boolean()}
  | {:proxy, map()}
  | {:downloads_path, binary()}
  | {:traces_dir, binary()}
  | {:artifacts_dir, binary()}
  | {:chromium_sandbox, boolean()}
  | {:firefox_user_prefs, %{optional(atom() | binary()) => term()}}
  | {:cdp_port, non_neg_integer()}
  | {:slow_mo, integer() | float()}

Functions

launch(type_id, opts \\ [])

@spec launch(PlaywrightEx.guid(), [launch_opt() | PlaywrightEx.unknown_opt()]) ::
  {:ok, %{guid: PlaywrightEx.guid()}} | {:error, any()}

Launches a new browser instance.

Reference: https://playwright.dev/docs/api/class-browsertype#browser-type-launch

Options

  • :connection (term/0) - The Connection process name. Defaults to PlaywrightEx.Supervisor.Connection. The default value is PlaywrightEx.Supervisor.Connection.

  • :timeout (timeout/0) - Required. Maximum time for the operation (milliseconds).

  • :channel (String.t/0) - Browser distribution channel.

  • :args (list of String.t/0) - Additional command-line arguments passed to the browser.

  • :executable_path (String.t/0) - Path to a browser executable to run instead of the bundled one.

  • :ignore_all_default_args (boolean/0) - Whether to omit all Playwright default browser arguments.

  • :ignore_default_args (list of String.t/0) - Specific Playwright default browser arguments to omit.

  • :handle_sigint (boolean/0) - Whether Playwright handles SIGINT.

  • :handle_sigterm (boolean/0) - Whether Playwright handles SIGTERM.

  • :handle_sighup (boolean/0) - Whether Playwright handles SIGHUP.

  • :env - Environment variables as a map or Playwright name/value entries.

  • :headless (boolean/0) - Whether to run browser in headless mode.

  • :proxy (map/0) - Proxy settings for the browser process.

  • :downloads_path (String.t/0) - Directory in which to place downloads.

  • :traces_dir (String.t/0) - Directory in which to place tracing data.

  • :artifacts_dir (String.t/0) - Directory in which to place browser artifacts.

  • :chromium_sandbox (boolean/0) - Whether Chromium sandboxing is enabled.

  • :firefox_user_prefs - Firefox preferences, preserved as an opaque JSON object.

  • :cdp_port (non_neg_integer/0) - Chrome DevTools Protocol port.

  • :slow_mo - Slows down Playwright operations by the specified amount of milliseconds.