I want to use the browser console to click all links on a page of a certain type programmatically.
Thanks to this answer I've gotten this far successfully:
const inputs = document.querySelectorAll('[href^="myhref"]');
for (let i = 0; i < inputs.length; i++) {
setTimeout(function() {
inputs[i].click()
}, 150 * i);
}
This works great if there are no iframes involved. The page I'm working with, the links I want to hit are all within an iframe. (The iframe is within the same domain, so that's not a concern.)
Right now I can get this to work if I Inspect and select something within the iframe first, but what would I have to do here to search within the iframe to begin with?