← Back to DOM domain

DOM.getAttributes

Returns attributes for the specified node.

Domain: DOM stable

Parameters

NameTypeDescription
nodeIdNodeIdId of the node to retrieve attributes for.

Returns

NameTypeDescription
attributesarrayAn interleaved array of node attribute names and values.

Example Request

{
  "id": 1,
  "method": "DOM.getAttributes",
  "params": {
    "nodeId": 1
  }
}

Example Response

{
  "id": 1,
  "result": {
    "attributes": [
      "class",
      "container",
      "id",
      "main"
    ]
  }
}

Usage in Node.js

const result = await send('DOM.getAttributes', {"nodeId": 1});
console.log(result);
// {"attributes": ["class", "container", "id", "main"]}