Blog
December 15, 2015 Marie H.

jQuery, JavaScript and hacking your LinkedIn profile

jQuery, JavaScript and hacking your LinkedIn profile

Photo by <a href="https://unsplash.com/@laviperchik?utm_source=cloudista&utm_medium=referral" target="_blank" rel="noopener">Lavi Perchik</a> on <a href="https://unsplash.com/?utm_source=cloudista&utm_medium=referral" target="_blank" rel="noopener">Unsplash</a>

I got frustrated at the volume of "People You May Know" suggestions and wanted a faster way to work through them. A quick inspect element, a bit of console work, and I grew my LinkedIn profile by 700 connections and jumped from top 30% to top 5% in profile views.

The idea is simple: open the browser console and fire a click event on every Connect button on the page at once.

Current approach (2023+ DOM)

LinkedIn's class names are obfuscated and change frequently, so targeting by text content is more durable than relying on a specific class:

// Click all visible "Connect" buttons on the page
document.querySelectorAll('button').forEach(btn => {
    if (btn.innerText.trim() === 'Connect') {
        btn.click();
    }
});

If LinkedIn shows a confirmation modal after each click, you'll need to dismiss it too:

// Click Connect, then confirm each modal
async function connectAll() {
    const buttons = [...document.querySelectorAll('button')].filter(
        b => b.innerText.trim() === 'Connect'
    );
    for (const btn of buttons) {
        btn.click();
        await new Promise(r => setTimeout(r, 500));
        // Dismiss "Add a note?" modal if it appears
        const send = [...document.querySelectorAll('button')].find(
            b => b.innerText.trim() === 'Send without a note'
        );
        if (send) send.click();
        await new Promise(r => setTimeout(r, 300));
    }
    console.log(`Sent ${buttons.length} connection requests`);
}

connectAll();

How to use it

  1. Go to My Network > People You May Know
  2. Scroll down until you have a few pages worth of suggestions loaded
  3. Open the browser console: Right click → Inspect → Console (or F12)
  4. Paste the script above and hit Enter

Repeat every few days as new suggestions appear. Just be aware that LinkedIn does rate-limit connection requests — sending too many too fast can get your account flagged. Run it on a loaded page rather than firing it in a loop across multiple pages.

Use at your own risk. This likely violates LinkedIn's ToS. I haven't had an account actioned for it but that doesn't mean you won't.

Official alternative: LinkedIn API

If you're building something that needs to do this programmatically and reliably, use the LinkedIn Marketing Developer Platform. The People API (v2) lets you search for people and manage connection requests with proper auth:

import requests

# After OAuth2 flow to get access_token
headers = {
    'Authorization': f'Bearer {access_token}',
    'Content-Type': 'application/json',
}

# Search for people
resp = requests.get(
    'https://api.linkedin.com/v2/people',
    headers=headers,
    params={'q': 'viewers'}  # profile viewers, connections of connections, etc.
)
print(resp.json())

The API is gated behind a developer application approval process, but it's the right call if you're doing anything at scale.