Packages
playwright
0.1.17-preview-2
1.49.1-alpha.2
1.49.1-alpha.1
1.44.0-alpha.4
1.44.0-alpha.3
1.44.0-alpha.2
1.44.0-alpha.1
1.18.0-alpha.1
0.1.17-preview-7
0.1.17-preview-6
0.1.17-preview-5
0.1.17-preview-4
0.1.17-preview-3
0.1.17-preview-2
0.1.17-preview-1
0.1.16-preview-3
0.1.16-preview-2
0.1.16-preview-1
0.1.1-preview
0.1.0-preview
Playwright is an Elixir library to automate Chromium, Firefox and WebKit browsers with a single API. Playwright delivers automation that is ever-green, capable, reliable and fast.
Current section
Files
Jump to
Current section
Files
lib/playwright.ex
defmodule Playwright do
@moduledoc """
`Playwright` module provides functions to launch a `Playwright.Browser`.
The following is a typical example of using `Playwright` to drive automation.
## Example
alias Playwright.{Browser, Page, Response}
browser = Playwright.launch(:chromium)
assert Browser.new_page(browser)
|> Page.goto("http://example.com")
|> Response.ok()
Browser.close(browser)
"""
use Playwright.ChannelOwner
@property :chromium
@typedoc "The web client type used for `launch` and `connect` functions."
@type client :: :chromium | :firefox | :webkit
@doc """
Launch an instance of `Playwright.Browser`.map()
## Arguments
- `client`: The type of client (browser) to launch.
`(:chromium | nil)` with default `:chromium`
"""
@spec launch(atom()) :: Playwright.Browser.t()
def launch(client \\ nil)
def launch(client) when is_nil(client) do
launch(:chromium)
end
def launch(client) when client in [:chromium, :firefox, :webkit] do
options = Playwright.Runner.Config.launch_options()
{_connection, browser} = Playwright.BrowserType.launch(client, options)
browser
end
end