DOM methods, browser sessions serve 14, phone sessions 0 and computer sessions 14. A method marked not served answers StrategyUnavailable on that kind of session; check the handshake’s capabilities before relying on one.
DOM.getDocument
Browser: served
Phone: not served
Computer: served
Takes targetId
The frame’s document, depth levels below the root (1 by default). Hidden elements, text nodes and wrappers are kept. Each node reports its real childCount; truncated says the 5000-node limit cut the read.
| Param | Type | Required | Description |
|---|---|---|---|
depth | integer | No | Levels below the node to return; 0 is the node alone. From 0 to 2147483647. |
| Field | Type | Description |
|---|---|---|
node | DOMNode | |
truncated | boolean |
DOM.getChildNodes
Browser: served
Phone: not served
Computer: served
Takes targetId
A page of a node’s children, with total; truncated as DOM.getDocument.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
offset | integer | No | |
limit | integer | No | Omitted or 0 returns as many as the node limit allows. |
depth | integer | No | Levels below the node to return; 0 is the node alone. From 0 to 2147483647. |
| Field | Type | Description |
|---|---|---|
nodes | DOMNode[] | |
total | integer | |
truncated | boolean |
DOM.describeNode
Browser: served
Phone: not served
Computer: served
Takes targetId
One node, depth levels below it (0 by default).
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
depth | integer | No | Levels below the node to return; 0 is the node alone. From 0 to 2147483647. |
| Field | Type | Description |
|---|---|---|
node | DOMNode | |
truncated | boolean |
DOM.querySelector
Browser: served
Phone: not served
Computer: served
Takes targetId
The first node matching selector (CSS) under nodeId, or in the frame’s document; null when nothing matches. Never waits.
| Param | Type | Required | Description |
|---|---|---|---|
selector | string | Yes | A CSS selector. |
nodeId | string | No | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
limit | integer | No | querySelectorAll only. Omitted or 0 means the default. From 0 to 10000. Default 1000. |
| Field | Type | Description |
|---|---|---|
nodeId | string | null |
DOM.querySelectorAll
Browser: served
Phone: not served
Computer: served
Takes targetId
Every node matching selector under nodeId, or in the frame’s document, in document order, up to limit (1000 by default, at most 10000). Never waits.
| Param | Type | Required | Description |
|---|---|---|---|
selector | string | Yes | A CSS selector. |
nodeId | string | No | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
limit | integer | No | querySelectorAll only. Omitted or 0 means the default. From 0 to 10000. Default 1000. |
| Field | Type | Description |
|---|---|---|
nodeIds | string[] | |
truncated | boolean |
DOM.getAttributes
Browser: served
Phone: not served
Computer: served
Takes targetId
A node’s attributes, in document order.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
| Field | Type | Description |
|---|---|---|
attributes | NameValue[] |
DOM.getOuterHTML
Browser: served
Phone: not served
Computer: served
Takes targetId
A node’s markup, in chunks of at most 1 MiB: read from offset 0 and follow nextOffset until it is absent, so large pages are never cut short. Offset 0 takes a snapshot of the markup, and later chunks come from that snapshot, so a page that changes between calls can’t tear the result. The snapshot is kept until its last chunk is read or 60 seconds pass; a later offset with no snapshot fails with StaleNode, and the client reads again from 0.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
offset | integer | No | Byte offset of the chunk to read: 0, or a previous nextOffset. |
| Field | Type | Description |
|---|---|---|
outerHTML | string | This chunk, at most 1 MiB, ending on a character boundary. |
totalBytes | integer | The whole markup’s UTF-8 length. |
nextOffset | integer | Where the next chunk starts; absent on the last chunk. |
DOM.getBoxModel
Browser: served
Phone: not served
Computer: served
Takes targetId
A node’s content, padding, border and margin boxes, as axis-aligned bounds in window pixels, also for a node inside an iframe.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
space | string | No | The space a call’s coordinates and returned bounds are in. screen is the desktop’s pixels from its top-left: the only space in a computer session, and its default there. In a browser session window (the default) is window pixels. viewport is the page’s CSS pixels from the main frame viewport’s top-left, as Playwright’s page.mouse and boundingBox use; under it a point outside the viewport fails with InvalidArgs. One of window, viewport, screen. Default "window". |
DOM.scrollIntoViewIfNeeded
Browser: served
Phone: not served
Computer: served
Takes targetId
Scroll until the node is in view, if it is not.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
{}.
DOM.setAttributeValue
Browser: served
Phone: not served
Computer: served
Takes targetId
Set an attribute. A programmatic change, not input: the page’s input handlers don’t run.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
name | string | Yes | |
value | string | Yes | |
idempotencyKey | string | No | Makes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys. |
{}.
DOM.removeAttribute
Browser: served
Phone: not served
Computer: served
Takes targetId
Remove an attribute.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
name | string | Yes | |
idempotencyKey | string | No | Makes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys. |
{}.
DOM.setNodeValue
Browser: served
Phone: not served
Computer: served
Takes targetId
Set a text or comment node’s value.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
value | string | Yes | |
idempotencyKey | string | No | Makes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys. |
{}.
DOM.setOuterHTML
Browser: served
Phone: not served
Computer: served
Takes targetId
Replace a node with outerHTML. The node’s id and its descendants’ ids are stale afterwards.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
outerHTML | string | Yes | |
idempotencyKey | string | No | Makes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys. |
{}.
DOM.removeNode
Browser: served
Phone: not served
Computer: served
Takes targetId
Remove a node. Its id and its descendants’ ids are stale afterwards.
| Param | Type | Required | Description |
|---|---|---|---|
nodeId | string | Yes | Opaque DOM node id, scoped to the tab, frame and document. Never parse it. Fails with StaleNode once the node is gone, or when sent with another frame’s frameId; it never matches a different node. |
idempotencyKey | string | No | Makes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys. |
{}.