Last active
December 8, 2025 04:51
-
-
Save VioletVivirand/727c380266d157d909b670911c1fca44 to your computer and use it in GitHub Desktop.
Usage: 1. Open AWS Events Content Page (https://aws.amazon.com/events/events-content/), 2. Open browser's developer tool and switch to console, 3. Paste the code and execute.
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 clickShowMoreUntilDone() { | |
| function findButtonByText() { | |
| // use CSS to grab all buttons, then filter by text (keeps selector usage) | |
| const allButtons = Array.from(document.querySelectorAll('button')); | |
| // prefer buttons inside <main> (if exists) | |
| const main = document.querySelector('main') || document.body; | |
| const candidates = allButtons.filter(b => main.contains(b)); | |
| const list = candidates.length ? candidates : allButtons; | |
| return list.find(b => /\bshow\s+\d+\s+more\b/i.test(b.textContent.trim())) || null; | |
| } | |
| function findShowMoreButton() { | |
| // 1) Try search text among buttons | |
| const byText = findButtonByText(); | |
| if (byText) { | |
| console.log("Found button by text:", JSON.stringify(byText.textContent.trim())); | |
| return byText; | |
| } | |
| // 2) If none of element matched, return NaN | |
| return; | |
| } | |
| const btn = findShowMoreButton(); | |
| if (!btn) { | |
| console.log("Couldn't find a 'Show N more' button on this page."); | |
| return; | |
| } | |
| console.log("Clicking:", JSON.stringify(btn.textContent.trim())); | |
| btn.click(); | |
| // Wait for DOM to update, then try again | |
| console.log("Waiting 3 secs for DOM to update and make another run..."); | |
| setTimeout(clickShowMoreUntilDone, 3000); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment