Last active
September 3, 2025 04:03
-
-
Save LikeCarter/1672becbed3bcda17a25baed414050d8 to your computer and use it in GitHub Desktop.
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
| function performActions() { | |
| const rows = document.querySelectorAll('.uf-table-row-clickable'); | |
| const downloadDelay = 2300; // Delay in milliseconds before clicking the download button | |
| const mouseEvent = (element) => { | |
| if (element) { | |
| element.dispatchEvent(new MouseEvent('click', { | |
| bubbles: true, | |
| cancelable: true, | |
| view: window | |
| })); | |
| } | |
| }; | |
| const processRow = (index) => { | |
| if (index >= rows.length) { | |
| console.log('Finished processing all rows. 🎉'); | |
| return; | |
| } | |
| const row = rows[index]; | |
| console.log(`Processing row ${index + 1}/${rows.length}`); | |
| // Click the current row immediately | |
| mouseEvent(row); | |
| // Wait for the download button to appear and then click it | |
| setTimeout(() => { | |
| const downloadButton = document.querySelector('[iconname="download"]'); | |
| if (downloadButton) { | |
| mouseEvent(downloadButton); | |
| console.log('Clicked download button. ⬇️'); | |
| // Click the close button immediately after clicking download | |
| const closeButton = document.getElementById('uf_process_close_estatementsPdfOverviewOverlay'); | |
| if (closeButton) { | |
| mouseEvent(closeButton); | |
| console.log('Clicked close button using its ID. ❌'); | |
| } else { | |
| console.log('Close button with specified ID not found. 🤷♂️'); | |
| } | |
| // Process the next row after a short delay to allow for page state change | |
| setTimeout(() => { | |
| processRow(index + 1); | |
| }, 500); // Small delay before next row to be safe | |
| } else { | |
| console.log('Download button not found. Moving to next row.'); | |
| processRow(index + 1); | |
| } | |
| }, downloadDelay); | |
| }; | |
| processRow(0); | |
| } | |
| // Run the function | |
| performActions(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment