Last active
January 12, 2018 19:11
-
-
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.
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
// 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'); |
Class name for CVS seems to be 'coupon_status'
but would recommend possibly attempting only a few at a time or perhaps implementing a timer between requests and running overnight as I am now denied access for attempting this crawl.
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
Class name for Safeway is
'lt-offer-Clip ng-scope'