Skip to content

Instantly share code, notes, and snippets.

@acoyfellow
Created June 20, 2024 15:15
Show Gist options
  • Save acoyfellow/058fbb5f8ad6436f8330d4439a8deab9 to your computer and use it in GitHub Desktop.
Save acoyfellow/058fbb5f8ad6436f8330d4439a8deab9 to your computer and use it in GitHub Desktop.
LinkedIn Auto follow w/ pagination
async function autoFollow() {
const buttons = document.querySelectorAll("[aria-label*='Invite']");
for (let i = 0; i < buttons.length; i++) {
buttons[i].click();
await new Promise(resolve => setTimeout(resolve, 200));
const sendButton = document.querySelector("[aria-label='Send without a note']");
if (sendButton) {
sendButton.click();
}
await new Promise(resolve => setTimeout(resolve, 1000));
}
// Wait for all invites to be sent
await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds
// Click the "Next" button
const nextButton = document.querySelector("[aria-label='Next']");
if (nextButton) {
nextButton.click();
// Wait for the next page to load
await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds
// Run the autoFollow function again
autoFollow();
}
}
// Start the process
autoFollow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment