Skip to content

Instantly share code, notes, and snippets.

@speedoholic
Last active June 23, 2019 17:01
Show Gist options
  • Save speedoholic/a0734c57a21ef580fb2d064cf5dab06e to your computer and use it in GitHub Desktop.
Save speedoholic/a0734c57a21ef580fb2d064cf5dab06e to your computer and use it in GitHub Desktop.
Don't want to pay for those browser extensions that help you add more connections on LinkedIn? Use this snippet while you are on the "search/results/people/" page and filters are applied to get "People" who are "2nd" or "3rd+" connections. Feel free to optimize it or add more functionalities.
function clickSend(x,i) {
var y = document.getElementsByClassName('artdeco-button--3 ml1');
if(y.length > 0) {
y[0].click();
console.log("Request sent for index: "+ i)
setTimeout(function(){
clickConnect(x,i+1);
}, 1000);
} else {
console.log("Button not found for index: " + i)
setTimeout(function(){
clickConnect(x,i+1);
}, 1000);
}
setTimeout
}
function clickConnect(x,i) {
if(x.length > i) {
x[i].click();
console.log("Process started for index: " + i)
setTimeout(function(){
clickSend(x,i);
}, 1000);
} else {
console.log("End of page")
var z = document.getElementById('ember2234');
//You should inspect the element and check the ID for Next button
z.click();
setTimeout(function(){
sendRequests()
}, 3000);
}
}
function sendRequests() {
var x = document.getElementsByClassName('search-result__action-button');
console.log("Number of connect buttons found on page: " + x.length)
var i = 0
clickConnect(x,i);
}
sendRequests();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment