Created
August 16, 2018 06:00
-
-
Save eviltester/c29f2add0fc713a5185261a3f11a00fc to your computer and use it in GitHub Desktop.
find a bunch of stuff on the page and click on them
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
var divs = document.querySelectorAll('.button'); [].forEach.call(divs, function(div) { div.click();}); |
For loop which doesn't work in reverse:
var divs = document.querySelectorAll('input.toggle');
for (x = 0; x < divs.length; x++) {
divs[x].click();
}
Working in reverse can be useful when you are 'deleting' or the length changes over time, here my action doesn't change the length so I can start at the top and work down.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
a 'for' loop version would be: