Run JavaScript on [Web Page]
– Script:
var result = [];
// Get all links from the page
var elements = document.querySelectorAll(“a”);
for (let element of elements) {
result.push({
“url”: element.href,
“text”: element.innerText
});
}
// Call completion to finish
completion(result);
Notes
Safari Web Page items are only available when running your shortcut as an Action Extension in Safari.
Input
Safari eb page (Safari web pages)
Result
(Dictionary, Text, Boolean, Number) The output from the JavaScript (JSON)