Source code for social.linkedin

# -*- coding: utf-8 -*-
"""
=======================================================================================
social.linkedin module contains classes and methods specific to LinkedIn social network
=======================================================================================

   .. warning:: Coding style is CamelCase for classes and lowercase_separated_by_underscores A.K.A snake_case for
      methods and variables.
"""
from time import sleep


[docs]class LinkedIn: """ **Specificity of LinkedIn** at the moment, the classes specifies the login and post method Twitter. Contain also constant of the social network. """ name = "LinkedIn" url = "https://fr.linkedin.com/" home = "feed-tab-icon"
[docs] @staticmethod def login_submit(driver, login, password): """ Log in LinkedIn :param driver: Selenium driver of the bot :param login: Login to use for this bot :param password: Password to use for this bot """ email_input = driver.find_element_by_id("login-email") email_input.send_keys(login) password_input = driver.find_element_by_id("login-password") password_input.send_keys(password) submit_button = driver.find_element_by_id("login-submit") submit_button.click()
[docs] @staticmethod def post(driver, message): """ Method that defines the actions to post a message on LinkedIn :param driver: Selenium driver of the bot :param message: Message to post on linkedIn """ post_input = driver.find_element_by_class_name("sharing-create-share-view__create-content") post_input.click() sleep(0.25) post_input = driver.find_element_by_css_selector(".mentions-texteditor__contenteditable") post_input.send_keys(message) sleep(0.25) submit_button = driver.find_element_by_css_selector('button.post') submit_button.click()