Skip to content

Instantly share code, notes, and snippets.

@jadiagaurang
Last active April 16, 2024 15:56
Show Gist options
  • Save jadiagaurang/4cd13032d5dec53c80cd9ac7da2e3270 to your computer and use it in GitHub Desktop.
Save jadiagaurang/4cd13032d5dec53c80cd9ac7da2e3270 to your computer and use it in GitHub Desktop.
// Find all Send to Card Buttons
let arrayElements = document.querySelectorAll(".coupon-action.button-blue.sc-send-to-card-action");
// Declare a Looping Function to Delay Click Event!
function loopThroughNodes(arrayElements) {
let intDelay = 2000; // 2 Seconds Timeout to
for (var i = 0; i < arrayElements.length; i++) {
(function (i) {
let timeoutID = window.setTimeout(function () {
//console.log(arrayElements[i]);
// Scroll the element
arrayElements[i].scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" });
// Trigger Native Click Event Handler
arrayElements[i].click();
}, intDelay * i);
//console.log(timeoutID);
})(i);
};
}
// Start the Engines!
loopThroughNodes(arrayElements);
@neth392
Copy link

neth392 commented Apr 16, 2024

Note they changed button-red to button-blue

@jadiagaurang
Copy link
Author

Hi @neth392

Thanks for pointing out. I updated the DOM Selector Query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment