Created
February 23, 2025 13:07
-
-
Save Azd325/2c625c02fa7fe82fb735675a0ea202a9 to your computer and use it in GitHub Desktop.
Helper to download documents from DKB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function clickWithDelayReverse(selector, delay) { | |
const buttons = Array.from(document.querySelectorAll(selector)).reverse(); // Convert to array & reverse | |
for (const [index, button] of buttons.entries()) { | |
console.log(`Clicking button ${buttons.length - index} in reverse order`); | |
button.click(); | |
await new Promise(resolve => setTimeout(resolve, delay)); // Wait before next click | |
} | |
console.log("All downloads triggered in reverse order."); | |
} | |
// Clicks each button inside '.sc-cFTihx.bHGjRu' in reverse order with a 5-second delay | |
clickWithDelayReverse('.sc-cFTihx.bHGjRu button', 5000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment