Skip to content

Instantly share code, notes, and snippets.

@brunocsouto
Last active August 9, 2023 20:58
Show Gist options
  • Save brunocsouto/907e8c0e19fe8eff8f7d91b31293972e to your computer and use it in GitHub Desktop.
Save brunocsouto/907e8c0e19fe8eff8f7d91b31293972e to your computer and use it in GitHub Desktop.
Send connection request inside a LinkedIn People list
// Copy/paste below code into browser console
// when you're in a People list
// call 'connect()' method every page
// it will send connection request to every person with 'Connect' button inside that page
function delay(time) {
return new Promise(resolve => setTimeout(resolve, time))
}
function findButtons() {
return Array.from(document.querySelectorAll('span'))
}
function filterButtonsByText(buttons, text) {
return buttons.filter(button => button.innerText === text)
}
function connect() {
const buttons = findButtons()
const connectButtons = filterButtonsByText(buttons, 'Connect')
connectButtons.map((connectButton, index) => {
delay(index*2000).then(() => {
connectButton.click()
delay((index+1)*500).then(() => {
const _buttons = findButtons()
const sendButtons = filterButtonsByText(_buttons, 'Send')
sendButtons[0].click()
})
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment