Skip to content

Instantly share code, notes, and snippets.

@laricko
Last active May 29, 2024 17:16
Show Gist options
  • Save laricko/25ae5a7d3ea0b2c105d9ca07cf8b4b74 to your computer and use it in GitHub Desktop.
Save laricko/25ae5a7d3ea0b2c105d9ca07cf8b4b74 to your computer and use it in GitHub Desktop.
Bulk connections delete from LinkedIn
// Make sure to open LinkedIn Connections page
// and then run this script in the console.
async function deleteConnections(howMany) {
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
const connectionButtons = Array.from(document.querySelectorAll('button.mn-connection-card__dropdown-trigger')).slice(0, howMany);
for (const button of connectionButtons) {
button.click();
await delay(400);
const menuItem = Array.from(document.querySelectorAll('button')).find(item => item.innerText.includes('Remove connection'));
if (menuItem) {
menuItem.click();
await delay(400);
const confirmButton = document.querySelector('button[aria-label^="Remove"]');
if (confirmButton) {
confirmButton.click();
await delay(700);
}
}
await delay(1400);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment