Skip to content

Instantly share code, notes, and snippets.

@tuffacton
Last active January 12, 2018 19:11
Show Gist options
  • Save tuffacton/433a0e122ca019d4794a8ce22847df1b to your computer and use it in GitHub Desktop.
Save tuffacton/433a0e122ca019d4794a8ce22847df1b to your computer and use it in GitHub Desktop.
Using dev console, click all elements of a given class on a page. Very useful for grocery store rewards pages where you can click on hundreds of coupons.
// Create function
function waitScrape(class_name)
{
console.log("Starting");
var buttons = document.getElementsByClassName(class_name);
for(i = 0; i <= buttons.length; i++) {
setTimeout(function () {
// register click event
buttons[i].click();
// Set wait time for 3 seconds (3000 milliseconds)
}, 3000);
}
}
// Initiate function
waitsScrape('UnFollowUser');
@tuffacton
Copy link
Author

Implemented timer, need to see if I can simulate a "page down" event in order to load all coupons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment