Created
July 30, 2025 13:38
-
-
Save j0rd1s3rr4n0/350b05a9385cfdf9a29bb9e1520262b7 to your computer and use it in GitHub Desktop.
Auto Connect for LinkedIn
This file contains hidden or 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
| // Function to generate a random delay between min and max milliseconds | |
| function getRandomDelay(min, max) { | |
| return Math.floor(Math.random() * (max - min + 1)) + min; | |
| } | |
| // Function to pause execution for a given duration | |
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| // Main asynchronous function to handle clicks with delays | |
| async function clickConnectButtonsWithDelay() { | |
| const buttons = document.querySelectorAll("ul")[5].querySelectorAll('button'); | |
| for (const button of buttons) { // Use for...of to allow await inside | |
| if (button.innerText.trim() === 'Conectar') { // need to change the 'Connectar' to you main language. | |
| button.click(); | |
| console.log('Clicked "Conectar" button.'); | |
| let id = button.id; | |
| await sleep(350); | |
| document.querySelector("#artdeco-modal-outlet").childNodes[1].childNodes[1].childNodes[15].childNodes[6].click(); | |
| const delay = getRandomDelay(1000, 4500); // Get a random delay between 1000ms (1s) and 1500ms (1.5s) | |
| console.log(`Waiting for ${delay}ms before next action...`); | |
| await sleep(delay); // Pause execution for the random delay | |
| } | |
| } | |
| console.log('Finished checking all buttons.'); | |
| } | |
| // Call the main function to start the process | |
| clickConnectButtonsWithDelay(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment