function get_by_xpath(path, start) {
if (start == undefined || start == null) { start = document; }
let res = [];
let iter = document.evaluate(path, start, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
while (true) {
let i = iter.iterateNext();
if (i == null) { break; }
res.push(i);
}
return res;
}
@aquarial @codepo8 I'm just straight-using the Dev Tools out of the box because most of the annoying sites I'm only visiting once. However there is the idea of snippets that could form a Greasemonkey successor. https://developer.chrome.com/docs/devtools/javascript/snippets/ https://learn.microsoft.com/en-us/microsoft-edge/devtools-guide-chromium/javascript/snippets
Snippets are small scripts that you can author and execute within the Sources panel of Chrome DevTools. You can access and run them from any page. When you run a…
Chrome Developers