Login to LinkedIn
2.1 Capturing Steps using clicknium VS Code extension
Besides writing Python source code to automate the login process and the job search as well as the storing of the data, we also need to capture the web elements on Chrome browser using the clicknium VS Code extension. To launch the extension, press Ctrl+Shift+P to open the command palette and type to select “clicknium capture”. This will open a new capture dialog and let the user record web elements using Ctrl+Click. After following the discussed steps as discussed below, click complete and execute the Python source code for clicknium.
2.2 In this section, we will scrape the related elements of the login page
2.3 Open the browser with LinkedIn website, input the account username and password and then click the Sign in button
Python3
from clicknium import clicknium as cc, locator # Create a browser instance with # "cc.chrome", for edge browser using "cc.edge" # Open browser with specified url and # get browser tab For default, it will # wait the page load completely. You do # not need to add extra time.sleep() _tab = cc.chrome. open ( "https://www.linkedin.com/" , is_wait_complete = True ) # Find input box for username # Fill in with the key value 'linkedin_login_name' # in setting.json _tab.find_element(locator.chrome.linkedin.login.login_email).set_text( Setting.login_name) # Find input box for password # Fill in with the key value 'linkedin_login_password' # in setting.json _tab.find_element(locator.chrome.linkedin.login.login_password).set_text( Setting.login_password) # Find submit button, and click it to login _tab.find_element(locator.chrome.linkedin.login.signin).click() # Wait skip add phone button appears in 5 seconds, # if it exists, click the 'skip' button _tab.wait_appear(locator.chrome.linkedin.login.skip_add_phone, wait_timeout = 5 ).click() |
Automatically Get Top 10 Jobs from LinkedIn Using Python
Here we are going to use Clicknium to scrape LinkedIn top 10 jobs. First, we will login to LinkedIn to search the jobs according to the job keyword(the title, the skill, or the company) and the location, and then get the top 10 jobs in the search results. For each job, we will get the job information, such as the title, the company name, the size of the company, the post date, the job type, and the link URL. At last, we will save the results into CSV file.
The steps overview are as below:
- Login to LinkedIn
- Search jobs with the keyword and location
- Scrape the information of the top 10 jobs
- Save search results into csv file