Created
March 10, 2018 18:59
-
-
Save Th3redTea/262daa99462f748f8c42a49f57f23817 to your computer and use it in GitHub Desktop.
simple script to login to Linkedin account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
from selenium import webdriver | |
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
import time | |
binary = FirefoxBinary('/usr/bin/firefox') | |
browser = webdriver.Firefox(firefox_binary=binary) | |
from selenium.webdriver.common.keys import Keys | |
browser.get('https://www.linkedin.com/') | |
def loggin(): | |
Enter_email = browser.find_element_by_class_name('login-email') | |
Enter_email.clear() | |
Enter_email.send_keys('email') | |
Enter_pass = browser.find_element_by_class_name('login-password') | |
Enter_pass.clear() | |
Enter_pass.send_keys('password') | |
Enter_pass.send_keys(Keys.ENTER) | |
def search(): | |
searchBar = WebDriverWait(browser, 10).until( | |
EC.visibility_of_element_located( | |
(By.XPATH, "//input[@placeholder='Search']") | |
) | |
) | |
searchBar.clear() | |
searchBar.send_keys('Python') | |
searchBar.send_keys(Keys.ENTER) | |
People = WebDriverWait(browser, 10).until( | |
EC.element_to_be_clickable( | |
(By.XPATH, "//button[@data-vertical='PEOPLE']") | |
) | |
) | |
People.click() | |
connect_to = WebDriverWait(browser, 10).until( | |
EC.element_to_be_clickable( | |
(By.XPATH, "//button[@aria-label='Connect with {:name}']") | |
) | |
) | |
connect_to.click() | |
continue_co = WebDriverWait(browser, 10).until( | |
EC.element_to_be_clickable( | |
(By.XPATH, "//button[@class=''button-primary-large ml3'']") | |
) | |
) | |
continue_co.click() | |
loggin() | |
browser.implicitly_wait(6) | |
search() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment