Created
May 11, 2024 23:25
-
-
Save ankushagarwal/d57ac2b1767101c098f09caf95ff8407 to your computer and use it in GitHub Desktop.
Delete Facebook Marketplace Messages in Bulk
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
// Go to https://www.messenger.com/marketplace/ | |
// open browser consolle and run this script | |
function getElementByXpath(path) { | |
return document.evaluate( | |
path, | |
document, | |
null, | |
XPathResult.FIRST_ORDERED_NODE_TYPE, | |
null | |
).singleNodeValue; | |
} | |
function doIt() { | |
getElementByXpath = function getElementByXpath(path) { | |
return document.evaluate( | |
path, | |
document, | |
null, | |
XPathResult.FIRST_ORDERED_NODE_TYPE, | |
null | |
).singleNodeValue; | |
}; | |
document.querySelectorAll('[aria-label="Menu"]')[1].click(); | |
setTimeout(function () { | |
console.log("Calling first delete"); | |
getElementByXpath( | |
'//span[text()="Delete Chat" or text()="Delete chat"]' | |
).click(); | |
}, 1000); | |
setTimeout(function () { | |
console.log("Calling second delete"); | |
document.querySelector('div[aria-label="Delete chat"][role="button"]').click(); | |
}, 1500); | |
} | |
var myInt = setInterval(function () { | |
doIt(); | |
}, 2500); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment