Skip to content

Commit a7d1e3e

Browse files
Merge pull request #2109 from Avdhesh-Varshney/autoLinkedin
[GSSoC'23] Auto LinkedIn Script Resolved
2 parents 609c48c + 0600d74 commit a7d1e3e

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

Auto-Linkedin/Auto-LinkedIn.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from selenium import webdriver #connect python with webbrowser-chrome
2+
from selenium.webdriver.common.keys import Keys
3+
import pyautogui as pag
4+
5+
def main():
6+
url = "http://linkedin.com/" #url of LinkedIn
7+
network_url = "http://linkedin.com/mynetwork/" # url of LinkedIn network page
8+
driver = webdriver.Chrome('F:\Argha\WebDriver\chromedriver.exe') # path to browser web driver
9+
driver.get(url)
10+
11+
def login():
12+
username = driver.find_element_by_id("login-email") # Getting the login element
13+
username.send_keys("username") # Sending the keys for username
14+
password = driver.find_element_by_id("login-password") # Getting the password element
15+
password.send_keys("password") # Sending the keys for password
16+
driver.find_element_by_id("login-submit").click() # Getting the tag for submit button
17+
18+
def goto_network():
19+
driver.find_element_by_id("mynetwork-tab-icon").click()
20+
21+
def send_requests():
22+
n= input("Number of requsts: ") # Number of requests you want to send
23+
for i in range(0,n):
24+
pag.click(880,770) # position(in px) of connection button
25+
print("Done!")
26+

Auto-Linkedin/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Auto Linkedin
2+
3+
- It imports the necessary modules:
4+
- webdriver from Selenium to control the web browser,
5+
- Keys from Selenium to handle keyboard keys, and pyautogui as pag to simulate mouse clicks.
6+
7+
- The main() function sets up the Selenium WebDriver with the Chrome browser and opens the LinkedIn website.
8+
9+
- The login() function finds the login elements on the LinkedIn page and enters the provided username and password.
10+
11+
- It also clicks the submit button to log in.
12+
13+
- The goto_network() function clicks on the "My Network" tab on the LinkedIn page.
14+
15+
- The send_requests() function prompts the user to enter the number of connection requests they want to send.
16+
17+
- It then uses the PyAutoGUI library to simulate mouse clicks on the connection button (at the specified position) the specified number of times.
18+
19+
- Install this before running :
20+
1. pip install selenium
21+
2. pip install pyautogui
22+
23+
Once you have installed the necessary libraries and downloaded the Chrome WebDriver, you should be able to run the code successfully.
24+
25+
**Thanks for using this program**
26+

0 commit comments

Comments
 (0)