Skip to content

About

Elixir client for the Playwright node.js server.

Resources

Stars

23 stars

Watchers

0 watching

Forks

Repository files navigation

PlaywrightEx

Hex.pm Version Hex Docs License GitHub Actions Workflow Status

Elixir client for Playwright. Automate Chromium, Firefox and WebKit: end-to-end tests, web scraping, agentic AI.

PlaywrightEx is a 1:1 port of the official JavaScript client. Its API is generated from Playwright's docs, so the docs at playwright.dev apply. The driver (Node.js and playwright-core) is pinned and installed by Mix, no npm needed. This release drives Playwright 1.65.

Installation

def deps do
  [
    {:playwright_ex, "~> 0.17.0-rc.5"}
  ]
end
mix deps.get
mix playwright_ex.install

Example

alias PlaywrightEx.{Browser, BrowserType, Expect, Locator, Page, Playwright}

{:ok, _} = PlaywrightEx.Supervisor.start_link()
browser = BrowserType.launch!(Playwright.chromium(PlaywrightEx.playwright()))
page = Browser.new_page!(browser)
Page.goto!(page, "https://elixir-lang.org/")
Page.get_by_role(page, :link, name: "Install") |> Locator.click!()
Expect.to_have_title!(page, ~r/Install/)
# Closes the browser and waits for the driver to exit before the VM halts.
Supervisor.stop(PlaywrightEx)

timeout: 0 means no timeout. As in Playwright JS, it waits forever instead of failing at once. :infinity is the same and reads better in Elixir.

Reading playwright.dev

The Python docs are the closest read, since the names match Python's: snake_case, keyword options, expect_popup, eval_on_selector. page.get_by_role("button").click() is Page.get_by_role(page, :button) |> Locator.click!().

Guides

Feedback of any shape and size is welcome: get in touch.

Contributing

  1. mix setup installs dependencies, the pinned Playwright driver and Chromium.
  2. mix test, or mix check for everything CI runs.
  3. Porting rules: PORTING.md; the why behind the design: docs/architecture.md.

About

Elixir client for the Playwright node.js server.

Resources

Stars

23 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages