Skip to content
Related Articles

Related Articles

Improve Article

How to accept all pending connection requests on LinkedIn using JavaScript ?

  • Last Updated : 24 May, 2021
Geek Week

Many times we get a lot of connection requests over LinkedIn, and we want to accept all of them but for that, we have to click the accept button for each connection request. With the help of the following way, we can accept all of them at once using JavaScript helping us to save our time and effort.

Approach:

  • Make a variable connection that points to an array of all the pending connections.
  • Run a loop to iterate all the pending connection.
  • Then click on the accept button of that connection request using the JavaScript click function.

Steps:

  • Go to the LinkedIn page or click here.
  • If you are not Signed in. You should Sign in to your account.

  • Open the My Network tab visible on the page.



  • Click on the Show more button to see all the connection requests.
    Note: The show more button will only be visible if you have more than 3 connection requests. Keep on clicking until all the connection requests are visible.
  • Open the developer console by pressing F12 or CTRL+SHIFT+I

  • Copy and paste the following script on the console and hit enter.

Javascript




var connection = document
    .querySelectorAll(
    '.invitation-card__action-btn.artdeco-button--secondary');
 
for(var i = 0; i < connection.length; i = i + 1)
  connection[i].click();

Output:

Before running script:

After running script:

Note: 

  • Please ensure that there is a stable internet connection available so that the script runs smoothly.
  • The script will only work when all the connections are visible.
  • This tutorial is for educational purposes only.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it’s lowest price ever!

My Personal Notes arrow_drop_up
Recommended Articles
Page :