{"id":13804684,"url":"https://github.com/tatut/clj-chrome-devtools","last_synced_at":"2025-04-09T05:10:40.249Z","repository":{"id":24281457,"uuid":"100861108","full_name":"tatut/clj-chrome-devtools","owner":"tatut","description":"Clojure API for controlling a Chrome DevTools remote","archived":false,"fork":false,"pushed_at":"2024-09-16T06:09:07.000Z","size":645,"stargazers_count":129,"open_issues_count":4,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-02T04:03:35.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tatut.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-20T12:50:46.000Z","updated_at":"2025-03-24T07:12:31.000Z","dependencies_parsed_at":"2024-10-12T22:52:01.945Z","dependency_job_id":"b00adab6-8357-495e-9954-d093f6b396b2","html_url":"https://github.com/tatut/clj-chrome-devtools","commit_stats":{"total_commits":154,"total_committers":11,"mean_commits":14.0,"dds":"0.17532467532467533","last_synced_commit":"48a77f8cd64dae88acc271b46c48a647e41a7580"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatut%2Fclj-chrome-devtools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatut%2Fclj-chrome-devtools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatut%2Fclj-chrome-devtools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tatut%2Fclj-chrome-devtools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tatut","download_url":"https://codeload.github.com/tatut/clj-chrome-devtools/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980837,"owners_count":21027808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:00:52.567Z","updated_at":"2025-04-09T05:10:40.230Z","avatar_url":"https://github.com/tatut.png","language":"Clojure","funding_links":[],"categories":["Chrome DevTools Protocol"],"sub_categories":["Libraries for driving the protocol (or a layer above)"],"readme":"# clj-chrome-devtools\n\n[![Clojars Project](https://img.shields.io/clojars/v/clj-chrome-devtools.svg)](https://clojars.org/clj-chrome-devtools) ![Tests](https://github.com/tatut/clj-chrome-devtools/workflows/Push/badge.svg)\n\nclj-chrome-devtools is a simple library for controlling a headless Chrome with the\nChrome DevTools Protocol. The protocol is based on a websocket connection between\nclojure and chrome. All the functions are automatically generated from the protocol\nspecification JSON files.\n\n## Quick start with Babashka\n\nSee [bb.clj](https://github.com/tatut/clj-chrome-devtools/blob/master/bb.clj) file for a quick\nscript that can be used from [Babashka](https://babashka.org).\n\n## Goals\n\nThe goal of the project is to provide a general purpose library for using headless chrome, both in\nproduction use and in testing scenarios.\n\nThe CDP part, which is autogenerated, should be stable and will be updated when CDP protocol changes.\n\nThe higher level automation utilities is where most of the work is done and new automation utilities are welcome.\nPRs welcome, just follow the common pattern of providing two arities: one for using the global automation context and\none where it is provided as the first parameter.\n\n\n## API Docs\n\nSee codox generated [API docs](https://tatut.github.io/clj-chrome-devtools/api/index.html).\n\nAll the low-level auto-generated commands from Chrome Devtools Protocol are in `clj-chrome-devtools.command.*`\nnamespaces. Note: to use the low-level API you need to implement event handlers for listening to data Chrome sends\nthe client.\n\nThere is the beginnings of a rudimentary higher level API in `clj-chrome-devtools.automation`.\nThere is also a `clojure.test` fixture to run tests with a fresh headless chrome in `clj-chrome-devtools.automation.fixture`.\n\n## Example usage\n\nFor using the higher level API for screen scraping and browser testing, see [chrome_test.clj](https://github.com/tatut/clj-chrome-devtools/blob/master/test/clj_chrome_devtools/chrome_test.clj) file.\n\nThe following shows a simple REPL usage, navigating to a page and inspecting content.\nThe connection is the first parameter of all calls. You can also set the connection to use with\n`set-current-connection!` and omit the connection parameter for convenience.\n\n\n```clojure\nclj-chrome-devtools.core\u003e (def c (connect \"localhost\" 9222))\n#'clj-chrome-devtools.core/c\nclj-chrome-devtools.core\u003e (require '[clj-chrome-devtools.commands.page :as page]\n                                   '[clj-chrome-devtools.commands.dom :as dom])\nnil\nclj-chrome-devtools.core\u003e (page/navigate c {:url \"http://webjure.org/\"})\n{:frame-id \"68439.1\"}\nclj-chrome-devtools.core\u003e (dom/get-document c {:depth 1})\n{:root\n {:children\n  [{:node-type 1,\n    :node-id 2,\n    :backend-node-id 4,\n    :parent-id 1,\n    :node-name \"HTML\",\n    :node-value \"\",\n    :frame-id \"68439.1\",\n    :local-name \"html\",\n    :child-node-count 2,\n    :attributes []}],\n  :document-url \"http://webjure.org/\",\n  :node-type 9,\n  :base-url \"http://webjure.org/\",\n  :node-id 1,\n  :backend-node-id 3,\n  :node-name \"#document\",\n  :node-value \"\",\n  :xml-version \"\",\n  :local-name \"\",\n  :child-node-count 1}}\nclj-chrome-devtools.core\u003e (use 'clojure.repl)\nnil\nclj-chrome-devtools.core\u003e (doc dom/get-outer-html)\n-------------------------\nclj-chrome-devtools.commands.dom/get-outer-html\n([] [{:as params, :keys [node-id]}] [connection {:as params, :keys [node-id]}])\n  Returns node's HTML markup.\n\nParameters map keys:\n  :node-id              Id of the node to get markup for.\n\nReturn map keys:\n  :outer-html           Outer HTML markup.\nnil\nclj-chrome-devtools.core\u003e (dom/get-outer-html c {:node-id 1})\n{:outer-html\n \"\u003chtml\u003e\u003chead\u003e\\n    \u003ctitle\u003eWebjure\u003c/title\u003e\\n  \u003c/head\u003e\\n  \u003cbody\u003e\\n    Coming soon-ish!\\n  \\n\\n\u003c/body\u003e\u003c/html\u003e\"}\n```\n\n## Running ClojureScript test suite with `clj-chrome-devtools`\n\nThe `clj-chrome-devtools.cljs.test` contains a function that can be used to build and run\nClojureScript tests as part of your Clojure test without needing `doo` plugin or `karma` installed.\n\nSee [example in Tuck project](https://github.com/tatut/tuck/blob/master/test/tuck/chrome_test.clj).\n\nThe `build-and-test` function is meant to be called inside your test and it will build the specified\nClojureScript build that is defined in `project.clj` (e.g. \"test\") with an added test runner that\nrequires the specified namespaces and runs tests in them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatut%2Fclj-chrome-devtools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftatut%2Fclj-chrome-devtools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftatut%2Fclj-chrome-devtools/lists"}