DEV Community


Linkedin Bot (Web Automation Using Selenium)

・2 min read

Hi, it's Ankur.

This post is about powerful web automation library called Selenium and its implementation in python to login automatically into different famous social media sites.Sometimes its worth time taking to login everytime into your social media and remembering credentials. Web automation is one of the most hottest fields now a days used by a large scale of organization to automate their different processes.

But for todays article we are considering only Linkedin to get automatically logged into it with the help of web automation.

Tools/libraries which are going to use are as follows
python,selenium,time,chrome driver

Follow the following Steps to start

1.Download Chrome webdriver to enable Selenium to connect with your browser.
3.Downlaod the required version of Webdriver according to your Browser Version
4.Now extract the downloaded zip file and copy the .exe file to the Python main directory

Let's Start Coding

a. Create a file
b. import the libraries (Assuming you have already installed the above mentioned libraries)

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

c. Make a class named as Linkedin and make a function inside it that takes your username,password as arguement to login.

class Linkedin:
    def __init__(self,username,password):

Give path of your chrome driver in

d. Make a function inside the same class named as login

 def login(self):

Here bot.get will get the url of linkedin and after 3 second bot will find element by id "username" where it will fill your provided username.similarly for password it does same.

e. Now call the above class and press login


f. Now all done type the following command to execute

$ python3

similarly you can use the same concept to auto login into several social media account.

I hope this article will help people who want to learn about web automation.
And I hope the community grows more!

Discussion (3)

tomquirk profile image
Tom Quirk

This is really cool! I built a similar thing for LinkedIn (not based on Selenium though) - might be helpful 🙂

satya2436 profile image
Satya Prakash • Edited

well organised content, Explanation is very clear.

nakonechnyy profile image

It's better to use world's safest tool, call's Expandi You can find lots of useful information about it also on the blog page. With the expandi's AI you wouldn't be blocked by Linkedin