Last active
March 17, 2023 06:33
-
-
Save dhruska/057c4050f141c4ea5b14a155274f298f to your computer and use it in GitHub Desktop.
Script to automatically add all American Express offers
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 sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function clickAllOffers () { | |
const offerButtons = Array.from(document.getElementsByClassName("offer-cta")).filter(btn => btn.title === "Add to Card" || btn.title === "Activate Offer"); | |
for (const offerButton of offerButtons) { | |
console.log("Clicking offer button"); | |
offerButton.click(); | |
await sleep(2000); | |
}; | |
} | |
clickAllOffers(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perfect, thank you!