Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deletes all Facebook friend requests, execute on https://www.facebook.com/friends/requests
var x = document.evaluate('//input[@value="Delete Request"]', document.documentElement, null, XPathResult.ANY_TYPE, null);
// gotta build an array of the elements, iterators throw exceptions if you modify the DOM from under them
var elements = [];
var thisNode = x.iterateNext();
while (thisNode) {
elements.push(thisNode);
thisNode = x.iterateNext();
}
elements.forEach(function(e) {
e.click();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment