Automate LinkedIn using selenium

Sanjana V
featurepreneur
Published in
2 min readAug 10, 2021

In this article, I am going to explain the steps involved to automate your LinkedIn profile using selenium.

Prerequisite Downloads & Installs

  • Install Selenium, which is a tool for automating web applications.
  • Download ChromeDriver, which is a separate executable that WebDriver uses to control Chrome. Also, you will need to have a Google Chrome browser application for this to work.

Login Automation

We will create a variable “browser” which is an instance of Google Chrome, required to perform our commands.

from selenium import webdriverbrowser = webdriver.Chrome()browser.get('https://www.linkedin.com/login?fromSignIn=true&trk=guest_homepage-basic_nav-header-signin')

The browser. get() method will open the Google Chrome application and navigate to LinkedIn.

To populate the text forms on the LinkedIn homepage with an email address and password, Right Click on the webpage, click Inspect and the Dev Tools window will appear. Copy any one of the attributes for email address and password.

The below lines will find the email element on the page and the send_keys() method contains the email address to be entered.

email = browser.find_element_by_id('username')
email.send_keys('Your Login ID')

Similarly, we can do for password. Submit method is used to submit a form after you have sent data to a form.

password=browser.find_element_by_id('password')password.send_keys(‘Your Password’)password.submit()

Note: Replace the keys “Your Login ID” and “Your Password” with your LinkedIn login information.

Automate to a Profile page

The below lines will automate your LinkedIn profile page.

profile=browser.find_element_by_partial_link_text("Welcome, ")
profile.click()

Successfully we’ve to Automate your LinkedIn profile using selenium.

Thanks for reading!!

--

--