Created
December 17, 2022 07:13
-
-
Save jameswang14/1c6fcce91be6fe2ca1be4c92d2a39712 to your computer and use it in GitHub Desktop.
This file contains 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
let coupons = Array.from(document.querySelectorAll('button')) | |
.filter(el => el.textContent === 'Clip') | |
let lastCount = 0 | |
while (coupons.length > lastCount) { | |
lastCount = coupons.length | |
// scroll to bottom and wait for coupons to load | |
window.scrollTo(0, document.body.scrollHeight); | |
await new Promise(r => setTimeout(r, 2000)); | |
coupons = Array.from(document.querySelectorAll('button')) | |
.filter(el => el.textContent === 'Clip') | |
} | |
console.log("Done loading all coupons") | |
coupons.forEach((e, i) => setTimeout(() => {e.click()}, i*2000)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment