← Back to DOM domain

DOM.setNodeName

Sets node name for a node with given id.

Domain: DOM stable

Parameters

NameTypeDescription
nodeIdNodeIdId of the node to set name for.
namestringNew node's name.

Returns

NameTypeDescription
nodeIdNodeIdNew node's id.

Example Request

{
  "id": 1,
  "method": "DOM.setNodeName",
  "params": {
    "nodeId": 1,
    "name": "example-name"
  }
}

Example Response

{
  "id": 1,
  "result": {
    "nodeId": 3
  }
}

Usage in Node.js

const result = await send('DOM.setNodeName', {"nodeId": 1, "name": "example-name"});
console.log(result);
// {"nodeId": 3}