Skip to content

Instantly share code, notes, and snippets.

@charlottetan
Created April 2, 2022 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlottetan/e9b182fe1559e42c582ea3f95d4dc274 to your computer and use it in GitHub Desktop.
Save charlottetan/e9b182fe1559e42c582ea3f95d4dc274 to your computer and use it in GitHub Desktop.
Add all Amex offers to credit card
const offerButtons = Array.from(document.getElementsByClassName("btn btn-sm btn-fluid offer-cta btn-secondary"))
.filter(btn => btn.title == "Add to Card");
const offerMerchants = Array.from(document.getElementsByClassName("offer-info offer-column margin-b-md-down col-md-5"))
.map((offerInfo) => offerInfo.lastChild.innerHTML);
for (let index = 0; index < offerButtons.length; ++index) {
setTimeout(() => {
console.log(`Clicking offer button for ${offerMerchants[index]}`);
offerButtons[index].click()
}, Math.floor(Math.random() * 3000) + 2000 * index, index);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment