Last active
September 15, 2023 13:10
-
-
Save JoshuaKGoldberg/3876ed731e5bf09d280d4ae7b5f23d7d to your computer and use it in GitHub Desktop.
Automating Tidelift tasks because the website takes too long to use
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 waitFor(time) { | |
return new Promise((resolve) => setTimeout(resolve, time)); | |
} | |
async function acceptVisiblePackages() { | |
const containers = document.querySelectorAll("#container"); | |
for (const container of containers) { | |
container.click(); | |
await waitFor(500); | |
const choice = document.querySelector(`[value=repository_license]`); | |
choice.scrollIntoView(); | |
choice.click(); | |
await waitFor(500); | |
document.querySelector(".drawer-card-foot button").click(); | |
await waitFor(500); | |
} | |
} | |
for (const pager of document.querySelectorAll(".pagination-list li")) { | |
pager.click(); | |
await waitFor(2500); // todo: be more intelligent | |
await acceptVisiblePackages(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment