Liking cljdoc? Tell your friends :D

cuic.chrome.protocol

Direct low-level access to Chrome DevTools via Chrome DevTools Protocol. Use cuic.chrome/devtools to obtain the to the browser's devtools client.

See https://chromedevtools.github.io/devtools-protocol for the complete DevTools Protocol reference.

Direct low-level access to Chrome DevTools via Chrome DevTools
Protocol. Use [[cuic.chrome/devtools]] to obtain the to the
browser's devtools client.

See https://chromedevtools.github.io/devtools-protocol for
the complete DevTools Protocol reference.
raw docstring

invokeclj

(invoke devtools cmd)
(invoke devtools cmd args)
(invoke devtools cmd args timeout)

Calls Chrome DevTools Protocol method and synchronously waits for the result, returning the received result or throwing an exception if invocation timeout exceeds or any other protocol error occurs.

Command arguments must be a map containing only JSON serializable values. Likewise, the invocation result is deserialized back to Clojure map before it is returned to the caller.

Use cuic.chrome/devtools to obtain the to the browser's devtools client.

;; Get cookies for the current url
(-> (invoke (chrome/devtools browser) "Network.getCookies")
    (:cookies))

;; Set _cuic_token cookie for localhost
(invoke (chrome/devtools browser)
        "Network.setCookie"
        {:name   "_cuic_token"
         :value  "tsers"
         :domain "localhost"})
Calls Chrome DevTools Protocol method and synchronously waits for the result,
returning the received result or throwing an exception if invocation timeout
exceeds or any other protocol error occurs.

Command arguments must be a map containing only JSON serializable
values. Likewise, the invocation result is deserialized back to Clojure
map before it is returned to the caller.

Use [[cuic.chrome/devtools]] to obtain the to the browser's devtools client.

```clojure
;; Get cookies for the current url
(-> (invoke (chrome/devtools browser) "Network.getCookies")
    (:cookies))

;; Set _cuic_token cookie for localhost
(invoke (chrome/devtools browser)
        "Network.setCookie"
        {:name   "_cuic_token"
         :value  "tsers"
         :domain "localhost"})
```
sourceraw docstring

node-idclj

(node-id element)

Returns NodeId for the given html element.

(let [query-input (c/find ".query")]
  ;; Describe query input node
  (invoke (chrome/devtools browser)
          "DOM.describeNode"
          {:nodeId (node-id query-input)}))
Returns [NodeId](https://chromedevtools.github.io/devtools-protocol/tot/DOM/#type-NodeId)
for the given html element.

```clojure
(let [query-input (c/find ".query")]
  ;; Describe query input node
  (invoke (chrome/devtools browser)
          "DOM.describeNode"
          {:nodeId (node-id query-input)}))
```
sourceraw docstring

object-idclj

(object-id obj)

Returns RemoveObjectId for the given JavaScript object reference.

(let [query-input (c/find ".query")]
  (invoke (chrome/devtools browser)
          "Runtime.getProperties"
          {:objectId (object-id query-input)
           :ownProperties true}))
Returns [RemoveObjectId](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObjectId)
for the given JavaScript object reference.

```clojure
(let [query-input (c/find ".query")]
  (invoke (chrome/devtools browser)
          "Runtime.getProperties"
          {:objectId (object-id query-input)
           :ownProperties true}))
```
sourceraw docstring

offclj

(off subscription)

Disposes the subscription from [[cuic.devtools/on]]. Can be called multiple times per subscription but subsequent calls are no-ops.

(let [subscription (on ...)]
  ...
  (off subscription))
Disposes the subscription from [[cuic.devtools/on]]. Can be called
multiple times per subscription but subsequent calls are no-ops.

```clojure
(let [subscription (on ...)]
  ...
  (off subscription))
```
sourceraw docstring

onclj

(on devtools event f)

Subscribes to the domain events, invoking the given callback each time a new event occurs. Returns a subscription that can be disposed with [[cuic.devtools/off]]. Subscriptions also implement java.lang.AutoCloseable so they can be used with Clojure's with-open macro. Disposing a subscription is an idempotent action.

;; Enable log domain
(invoke (chrome/devtools browser) "Log.enable")
;; Start printing browser console logs to stdout
(tools/on (chrome/devtools browser) "Log.entryAdded" println)
Subscribes to the domain events, invoking the given callback each
time a new event occurs. Returns a subscription that can be disposed
with [[cuic.devtools/off]]. Subscriptions also implement
`java.lang.AutoCloseable` so they can be used with Clojure's
`with-open` macro. Disposing a subscription is an idempotent action.

```
;; Enable log domain
(invoke (chrome/devtools browser) "Log.enable")
;; Start printing browser console logs to stdout
(tools/on (chrome/devtools browser) "Log.entryAdded" println)
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close