My code works fine, except it opens all links at the same time. I would like to use a delay.
This opens all (more than one function "Open") at the same time:
waitForKeyElements ("input.submit[onclick*='Open']", clickOpenBtn);
but I want a delay between each function call (clickOpenBtn
).
My complete code snippet:
setTimeout(CheckForZero, 30000); // OR just call CheckForZero() if you don't need to defer until processing is complete
function CheckForZero() {
waitForKeyElements ("input.submit[onclick*='Open']", clickOpenBtn);
setTimeout(CheckForZero, 30000);
}
function clickOpenBtn (jNode) {
triggerMouseEvent (jNode[0], "click");
}
function triggerMouseEvent (node, eventType) {
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent (eventType, true, true);
node.dispatchEvent (clickEvent);
}
What can I do?