Skip to content

Latest commit

 

History

History
67 lines (44 loc) · 2.11 KB

README.md

File metadata and controls

67 lines (44 loc) · 2.11 KB

Clojars Project

Deps

io.github.pfeodrippe/wally {:mvn/version "0.0.4"}

Leiningen

[io.github.pfeodrippe/wally "0.0.4"]

Wally

A Clojure Playwright wrapper.

Wally is a very nice person I work with, so I have created this library for him, also because I needed a library where I could use the w alias, but mostly because I am very fond of this good man =D

Very early alpha version, expect breaking changes!

Playwright is in the same category as the etaoin webdriver (parts of the API were heavily influenced by it), but leaning towards Cypress as there is huge support for testing, but, different from Cypress and like etaoin, PW just works in the REPL.

Examples

See an awesome example project made by https://github.com/PEZ (thanks!), https://github.com/PEZ/wally-example.

There is also https://github.com/pfeodrippe/wally-tests so we can test websites we love.

See how to PBT a webpage using Recife and Wally, https://recife.pfeodrippe.com/notebooks/recife/notebook/webdriver.html.

Usage

;; Here you have the main Wally namespace.
(require '[wally.main :as w])

;; Here you have some custom garden selectors + the usual ones.
(require '[wally.selectors :as ws])
(require '[garden.selectors :as s])

;; Copy jsonista deps.edn dep.
(do
  ;; When some command is run for the first time, Playwright
  ;; will kick in and open a browser.
  (w/navigate "https://clojars.org/metosin/jsonista")
  (w/click [(ws/text "Copy") (ws/nth= "1")]))

;; Check number of downloads for reitit.
(do
  (w/fill :#search "reitit")
  (w/keyboard-press "Enter")
  (w/click (s/a (s/attr= :href "/metosin/reitit")))
  (.textContent (w/-query (ws/text "Downloads"))))

;; Get the Playwright page object.
;; https://playwright.dev/docs/api/class-page.
(w/get-page)

Video

NOTE: In the video below, replace walstrom (old project name) with wally (new project name) for the requires.

Walstrom.mp4