Of the 14 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.
{"id": 1, "method": "DOM.getDocument", "params": {}}
ParamTypeRequiredDescription
depthintegerNoLevels below the node to return; 0 is the node alone. From 0 to 2147483647.
Result
FieldTypeDescription
nodeDOMNode
truncatedboolean

DOM.getChildNodes

Browser: served Phone: not served Computer: served Takes targetId A page of a node’s children, with total; truncated as DOM.getDocument.
{"id": 1, "method": "DOM.getChildNodes", "params": {"nodeId": "<nodeId>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
offsetintegerNo
limitintegerNoOmitted or 0 returns as many as the node limit allows.
depthintegerNoLevels below the node to return; 0 is the node alone. From 0 to 2147483647.
Result
FieldTypeDescription
nodesDOMNode[]
totalinteger
truncatedboolean

DOM.describeNode

Browser: served Phone: not served Computer: served Takes targetId One node, depth levels below it (0 by default).
{"id": 1, "method": "DOM.describeNode", "params": {"nodeId": "<nodeId>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
depthintegerNoLevels below the node to return; 0 is the node alone. From 0 to 2147483647.
Result
FieldTypeDescription
nodeDOMNode
truncatedboolean

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.
{"id": 1, "method": "DOM.querySelector", "params": {"selector": "<selector>"}}
ParamTypeRequiredDescription
selectorstringYesA CSS selector.
nodeIdstringNoOpaque 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.
limitintegerNoquerySelectorAll only. Omitted or 0 means the default. From 0 to 10000. Default 1000.
Result
FieldTypeDescription
nodeIdstring | 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.
{"id": 1, "method": "DOM.querySelectorAll", "params": {"selector": "<selector>"}}
ParamTypeRequiredDescription
selectorstringYesA CSS selector.
nodeIdstringNoOpaque 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.
limitintegerNoquerySelectorAll only. Omitted or 0 means the default. From 0 to 10000. Default 1000.
Result
FieldTypeDescription
nodeIdsstring[]
truncatedboolean

DOM.getAttributes

Browser: served Phone: not served Computer: served Takes targetId A node’s attributes, in document order.
{"id": 1, "method": "DOM.getAttributes", "params": {"nodeId": "<nodeId>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
Result
FieldTypeDescription
attributesNameValue[]

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.
{"id": 1, "method": "DOM.getOuterHTML", "params": {"nodeId": "<nodeId>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
offsetintegerNoByte offset of the chunk to read: 0, or a previous nextOffset.
Result
FieldTypeDescription
outerHTMLstringThis chunk, at most 1 MiB, ending on a character boundary.
totalBytesintegerThe whole markup’s UTF-8 length.
nextOffsetintegerWhere 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.
{"id": 1, "method": "DOM.getBoxModel", "params": {"nodeId": "<nodeId>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
spacestringNoThe 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".
Result
FieldTypeDescription
contentBbox
paddingBbox
borderBbox
marginBbox

DOM.scrollIntoViewIfNeeded

Browser: served Phone: not served Computer: served Takes targetId Scroll until the node is in view, if it is not.
{"id": 1, "method": "DOM.scrollIntoViewIfNeeded", "params": {"nodeId": "<nodeId>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
Result: an empty object {}.

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.
{"id": 1, "method": "DOM.setAttributeValue", "params": {"nodeId": "<nodeId>", "name": "href", "value": "<value>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
namestringYes
valuestringYes
idempotencyKeystringNoMakes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys.
Result: an empty object {}.

DOM.removeAttribute

Browser: served Phone: not served Computer: served Takes targetId Remove an attribute.
{"id": 1, "method": "DOM.removeAttribute", "params": {"nodeId": "<nodeId>", "name": "href"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
namestringYes
idempotencyKeystringNoMakes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys.
Result: an empty object {}.

DOM.setNodeValue

Browser: served Phone: not served Computer: served Takes targetId Set a text or comment node’s value.
{"id": 1, "method": "DOM.setNodeValue", "params": {"nodeId": "<nodeId>", "value": "<value>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
valuestringYes
idempotencyKeystringNoMakes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys.
Result: an empty object {}.

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.
{"id": 1, "method": "DOM.setOuterHTML", "params": {"nodeId": "<nodeId>", "outerHTML": "<outerHTML>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
outerHTMLstringYes
idempotencyKeystringNoMakes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys.
Result: an empty object {}.

DOM.removeNode

Browser: served Phone: not served Computer: served Takes targetId Remove a node. Its id and its descendants’ ids are stale afterwards.
{"id": 1, "method": "DOM.removeNode", "params": {"nodeId": "<nodeId>"}}
ParamTypeRequiredDescription
nodeIdstringYesOpaque 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.
idempotencyKeystringNoMakes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys.
Result: an empty object {}.