Skip to content

Instantly share code, notes, and snippets.

@ankushagarwal
Created May 11, 2024 23:25
Show Gist options
  • Save ankushagarwal/d57ac2b1767101c098f09caf95ff8407 to your computer and use it in GitHub Desktop.
Save ankushagarwal/d57ac2b1767101c098f09caf95ff8407 to your computer and use it in GitHub Desktop.
Delete Facebook Marketplace Messages in Bulk
// 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