Playwright browser + bb chrome devtools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; run npx playwright install to install a browser | |
(require '[babashka.deps :as deps]) | |
(deps/add-deps | |
'{:deps {tatut/devtools {:git/url "https://github.com/tatut/clj-chrome-devtools" | |
:git/sha "cc96255433ca406aaba8bcee17d0d0b3b16dc423"} | |
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha" | |
:git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}}}) | |
(ns pw | |
(:require | |
[babashka.process :refer [process destroy]] | |
[clj-chrome-devtools.automation :as auto] | |
[clj-chrome-devtools.core :as core])) | |
(defn chrome [] | |
(process "/Users/borkdude/Library/Caches/ms-playwright/chromium-930007/chrome-mac/Chromium.app/Contents/MacOS/Chromium --remote-debugging-port=9222")) | |
(def proc (chrome)) | |
(let [browser (auto/create-automation (core/connect))] | |
(reset! auto/current-automation browser) | |
(try | |
(auto/to "https://babashka.org") | |
(prn (auto/text-of "a.my-auto")) | |
(finally | |
(destroy proc)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment