Skip to content

Instantly share code, notes, and snippets.

@LikeCarter
Created September 25, 2025 17:00
Show Gist options
  • Select an option

  • Save LikeCarter/bcc77e1635ce06f1410398cd857fdba4 to your computer and use it in GitHub Desktop.

Select an option

Save LikeCarter/bcc77e1635ce06f1410398cd857fdba4 to your computer and use it in GitHub Desktop.
// 1. Select all elements that match the selector
const pdfButtons = document.querySelectorAll('button.buttonLink.ng-star-inserted:not([disabled])');
// 2. Loop through the elements and schedule the click with a delay
pdfButtons.forEach((button, index) => {
    // Calculate the delay for each button: 500ms * index
    const delay = 500 * (index + 1);
    // Schedule the click action after the calculated delay
    setTimeout(() => {
        // Ensure the element is still valid and visible before clicking (optional but good practice)
        if (button) {
            console.log(`Clicking button ${index + 1} with a delay of ${delay} ms...`);
            button.click(); // Simulate the mouse click
        }
    }, delay);
});
// Optional: Inform the user that the process has started
console.log(`Scheduled clicks for ${pdfButtons.length} buttons with a 500 ms interval.`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment