clj-chrome-devtools.commands.target

Supports additional targets discovery and allows to attach to them.

activate-target

(activate-target)(activate-target {:as params, :keys [target-id]})(activate-target connection {:as params, :keys [target-id]})

Activates (focuses) the target.

Parameters map keys:

Key Description
:target-id null

attach-to-browser-target

(attach-to-browser-target)(attach-to-browser-target {:as params, :keys []})(attach-to-browser-target connection {:as params, :keys []})

Attaches to the browser target, only uses flat sessionId mode.

Return map keys:

Key Description
:session-id Id assigned to the session.

attach-to-target

(attach-to-target)(attach-to-target {:as params, :keys [target-id flatten]})(attach-to-target connection {:as params, :keys [target-id flatten]})

Attaches to the target with given id.

Parameters map keys:

Key Description
:target-id null
:flatten Enables “flat” access to the session via specifying sessionId attribute in the commands.

We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325. (optional)

Return map keys:

Key Description
:session-id Id assigned to the session.

close-target

(close-target)(close-target {:as params, :keys [target-id]})(close-target connection {:as params, :keys [target-id]})

Closes the target. If the target is a page that gets closed too.

Parameters map keys:

Key Description
:target-id null

Return map keys:

Key Description
:success Always set to true. If an error occurs, the response indicates protocol error.

create-browser-context

(create-browser-context)(create-browser-context {:as params, :keys [dispose-on-detach proxy-server proxy-bypass-list origins-with-universal-network-access]})(create-browser-context connection {:as params, :keys [dispose-on-detach proxy-server proxy-bypass-list origins-with-universal-network-access]})

Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.

Parameters map keys:

Key Description
:dispose-on-detach If specified, disposes this context when debugging session disconnects. (optional)
:proxy-server Proxy server, similar to the one passed to –proxy-server (optional)
:proxy-bypass-list Proxy bypass list, similar to the one passed to –proxy-bypass-list (optional)
:origins-with-universal-network-access An optional list of origins to grant unlimited cross-origin access to.

Parts of the URL other than those constituting origin are ignored. (optional)

Return map keys:

Key Description
:browser-context-id The id of the context created.

create-target

(create-target)(create-target {:as params, :keys [url width height browser-context-id enable-begin-frame-control new-window background]})(create-target connection {:as params, :keys [url width height browser-context-id enable-begin-frame-control new-window background]})

Creates a new page.

Parameters map keys:

Key Description
:url The initial URL the page will be navigated to. An empty string indicates about:blank.
:width Frame width in DIP (headless chrome only). (optional)
:height Frame height in DIP (headless chrome only). (optional)
:browser-context-id The browser context to create the page in. (optional)
:enable-begin-frame-control Whether BeginFrames for this target will be controlled via DevTools (headless chrome only,

not supported on MacOS yet, false by default). (optional) :new-window | Whether to create a new Window or Tab (chrome-only, false by default). (optional) :background | Whether to create the target in background or foreground (chrome-only, false by default). (optional)

Return map keys:

Key Description
:target-id The id of the page opened.

detach-from-target

(detach-from-target)(detach-from-target {:as params, :keys [session-id target-id]})(detach-from-target connection {:as params, :keys [session-id target-id]})

Detaches session with given id.

Parameters map keys:

Key Description
:session-id Session to detach. (optional)
:target-id Deprecated. (optional)

dispose-browser-context

(dispose-browser-context)(dispose-browser-context {:as params, :keys [browser-context-id]})(dispose-browser-context connection {:as params, :keys [browser-context-id]})

Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.

Parameters map keys:

Key Description
:browser-context-id null

expose-dev-tools-protocol

(expose-dev-tools-protocol)(expose-dev-tools-protocol {:as params, :keys [target-id binding-name]})(expose-dev-tools-protocol connection {:as params, :keys [target-id binding-name]})

Inject object to the target’s main frame that provides a communication channel with browser target.

Injected object will be available as window[bindingName].

The object has the follwing API: - binding.send(json) - a method to send messages over the remote debugging protocol - binding.onmessage = json => handleMessage(json) - a callback that will be called for the protocol notifications and command responses.

Parameters map keys:

Key Description
:target-id null
:binding-name Binding name, ‘cdp’ if not specified. (optional)

get-browser-contexts

(get-browser-contexts)(get-browser-contexts {:as params, :keys []})(get-browser-contexts connection {:as params, :keys []})

Returns all browser contexts created with Target.createBrowserContext method.

Return map keys:

Key Description
:browser-context-ids An array of browser context ids.

get-target-info

(get-target-info)(get-target-info {:as params, :keys [target-id]})(get-target-info connection {:as params, :keys [target-id]})

Returns information about a target.

Parameters map keys:

Key Description
:target-id null (optional)

Return map keys:

Key Description
:target-info null

get-targets

(get-targets)(get-targets {:as params, :keys []})(get-targets connection {:as params, :keys []})

Retrieves a list of available targets.

Return map keys:

Key Description
:target-infos The list of targets.

send-message-to-target

(send-message-to-target)(send-message-to-target {:as params, :keys [message session-id target-id]})(send-message-to-target connection {:as params, :keys [message session-id target-id]})

Sends protocol message over session with given id. Consider using flat mode instead; see commands attachToTarget, setAutoAttach, and crbug.com/991325.

Parameters map keys:

Key Description
:message null
:session-id Identifier of the session. (optional)
:target-id Deprecated. (optional)

set-auto-attach

(set-auto-attach)(set-auto-attach {:as params, :keys [auto-attach wait-for-debugger-on-start flatten]})(set-auto-attach connection {:as params, :keys [auto-attach wait-for-debugger-on-start flatten]})

Controls whether to automatically attach to new targets which are considered to be related to this one. When turned on, attaches to all existing related targets as well. When turned off, automatically detaches from all currently attached targets. This also clears all targets added by autoAttachRelated from the list of targets to watch for creation of related targets.

Parameters map keys:

Key Description
:auto-attach Whether to auto-attach to related targets.
:wait-for-debugger-on-start Whether to pause new targets when attaching to them. Use Runtime.runIfWaitingForDebugger

to run paused targets. :flatten | Enables “flat” access to the session via specifying sessionId attribute in the commands. We plan to make this the default, deprecate non-flattened mode, and eventually retire it. See crbug.com/991325. (optional)

set-discover-targets

(set-discover-targets)(set-discover-targets {:as params, :keys [discover]})(set-discover-targets connection {:as params, :keys [discover]})

Controls whether to discover available targets and notify via targetCreated/targetInfoChanged/targetDestroyed events.

Parameters map keys:

Key Description
:discover Whether to discover available targets.

set-remote-locations

(set-remote-locations)(set-remote-locations {:as params, :keys [locations]})(set-remote-locations connection {:as params, :keys [locations]})

Enables target discovery for the specified locations, when setDiscoverTargets was set to true.

Parameters map keys:

Key Description
:locations List of remote locations.