|
1 |
| -from selenium import webdriver #connect python with webbrowser-chrome |
| 1 | +from selenium import webdriver # connect python with webbrowser-chrome |
2 | 2 | from selenium.webdriver.common.keys import Keys
|
3 | 3 | import pyautogui as pag
|
4 | 4 |
|
| 5 | + |
5 | 6 | def main():
|
6 |
| - url = "http://linkedin.com/" #url of LinkedIn |
| 7 | + url = "http://linkedin.com/" # url of LinkedIn |
7 | 8 | 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 | + # path to browser web driver |
| 10 | + driver = webdriver.Chrome('F:\Argha\WebDriver\chromedriver.exe') |
9 | 11 | driver.get(url)
|
10 | 12 |
|
| 13 | + |
11 | 14 | 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 |
| 15 | + username = driver.find_element_by_id( |
| 16 | + "login-email") # Getting the login element |
| 17 | + # Sending the keys for username |
| 18 | + username.send_keys("username") |
| 19 | + password = driver.find_element_by_id( |
| 20 | + "login-password") # Getting the password element |
| 21 | + # Sending the keys for password |
| 22 | + password.send_keys("password") |
| 23 | + # Getting the tag for submit button |
| 24 | + driver.find_element_by_id("login-submit").click() |
| 25 | + |
17 | 26 |
|
18 | 27 | def goto_network():
|
19 | 28 | driver.find_element_by_id("mynetwork-tab-icon").click()
|
20 | 29 |
|
| 30 | + |
21 | 31 | 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 |
| 32 | + n = input("Number of requsts: ") # Number of requests you want to send |
| 33 | + for i in range(0, n): |
| 34 | + pag.click(880, 770) # position(in px) of connection button |
25 | 35 | print("Done!")
|
26 |
| - |
|
0 commit comments