How to find all anchors with a specific role?

What is the best way to find all anchors in a website which have the role “treeitem” and to extract urls form them?

Example: I want to identify all lines like
"<a … class=“dijitTreeLabel” role=“treeitem” … href=“https://…”

  "Name": "dd",
  "CreationDate": "2023-2-20",
  "Commands": [
      "Command": "executeScript",
      "Target": "const elem = document.querySelectorAll('a[role=\"treeitem\"]')\n\nreturn Array.from(elem).map(v => v.href)",
      "Value": "TEST",
      "Description": ""
      "Command": "echo",
      "Target": "${TEST}",
      "Value": "",
      "Description": ""
1 Like

Wow! Thank you. Great solution.