Main entry point. Elixir client for the Playwright node.js driver.
Use launch_browser/2 to get started after adding PlaywrightEx.Supervisor to your supervision tree.
See the README for getting started and more details.
Summary
Functions
Launches a new browser instance, or returns the pre-launched browser when connected to a remote Playwright server.
Send message to playwright.
Subscribe to playwright responses concerning a resource, identified by its guid, or its descendants.
Messages in the format {:playwright_msg, %{} = msg} will be sent to pid.
Types
@type guid() :: String.t()
@type send_opt() :: {:connection, GenServer.name()} | {:timeout, timeout()}
@type subscribe_opt() :: {:connection, GenServer.name()} | {:pid, pid()}
@type unknown_opt() :: {Keyword.key(), Keyword.value()}
Functions
@spec launch_browser(atom(), [PlaywrightEx.BrowserType.launch_opt() | unknown_opt()]) :: {:ok, %{guid: guid()}} | {:error, any()}
Launches a new browser instance, or returns the pre-launched browser when connected to a remote Playwright server.
Options
:connection(term/0) - The Connection process name. Defaults toPlaywrightEx.Supervisor.Connection. The default value isPlaywrightEx.Supervisor.Connection.:timeout(timeout/0) - Required. Maximum time for the operation (milliseconds).:channel(String.t/0) - Browser distribution channel.:executable_path(String.t/0) - Path to a browser executable to run instead of the bundled one.:headless(boolean/0) - Whether to run browser in headless mode.:slow_mo- Slows down Playwright operations by the specified amount of milliseconds.
Send message to playwright.
Don't use this! Prefer Channels functions.
If a function is missing, consider opening a PR to add it.
Options
@spec subscribe(guid(), [subscribe_opt()]) :: :ok
Subscribe to playwright responses concerning a resource, identified by its guid, or its descendants.
Messages in the format {:playwright_msg, %{} = msg} will be sent to pid.