Skip to content

Commit b8d010f

Browse files
committed
Day 49
- Automating Job Applications on LinkedIn
1 parent 736cbc0 commit b8d010f

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
- [Day 46](https://github.com/a092devs/100-days-of-python/tree/master/day046) - Create a Spotify Playlist Using The Musical Time Machine
5555
- [Day 47](https://github.com/a092devs/100-days-of-python/tree/master/day047) - Create an Automated Amazon Price Tracker
5656
- [Day 48](https://github.com/a092devs/100-days-of-python/tree/master/day048) - Selenium Webdriver Browser and Game Playing Bot
57+
- [Day 49](https://github.com/a092devs/100-days-of-python/tree/master/day049) - Automating Job Applications on LinkedIn
5758

5859
## ⚙ Tools and Technologies Covered
5960
- Python 3

day049/main.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import os
2+
import time
3+
import dotenv
4+
from selenium import webdriver
5+
from selenium.webdriver.common.by import By
6+
from selenium.webdriver.edge.service import Service
7+
from selenium.webdriver.edge.options import Options
8+
from selenium.common.exceptions import NoSuchElementException
9+
10+
dotenv.load_dotenv("config.env", True)
11+
12+
MY_LID_EMAIL = os.environ.get("MY_LID_EMAIL")
13+
MY_LID_PASS = os.environ.get("MY_LID_PASS")
14+
15+
service = Service('C:\Development\chromedriver\msedgedriver.exe')
16+
17+
options = Options()
18+
options.add_experimental_option("detach", True)
19+
driver = webdriver.Edge(service=service, options=options)
20+
driver.maximize_window()
21+
driver.get('https://www.linkedin.com')
22+
23+
# Log in
24+
username = driver.find_element(By.ID, 'session_key')
25+
username.send_keys(MY_LID_EMAIL)
26+
time.sleep(1)
27+
username = driver.find_element(By.ID, 'session_password')
28+
username.send_keys(MY_LID_PASS)
29+
time.sleep(1)
30+
driver.find_element(By.XPATH, '//*[@id="main-content"]/section[1]/div/div/form/div[2]/button').click()
31+
time.sleep(5)
32+
33+
driver.get('https://www.linkedin.com/jobs/search/?f_AL=true&geoId=102713980&keywords=python%20developer&location=India&refresh=true')
34+
time.sleep(5)
35+
36+
jobs = driver.find_elements(by=By.CLASS_NAME, value='job-card-list__title')
37+
jobs_available = [job.text for job in jobs]
38+
print(jobs_available)
39+
40+
# Select job posting and click on apply
41+
while jobs_available:
42+
posting_num = 0
43+
try:
44+
driver.find_element(by=By.LINK_TEXT, value=f'{jobs_available[posting_num]}').click()
45+
time.sleep(2)
46+
driver.find_element(by=By.CLASS_NAME, value="jobs-s-apply").click()
47+
except NoSuchElementException:
48+
posting_num += 1
49+
driver.find_element(by=By.LINK_TEXT, value=f'{jobs_available[posting_num]}').click()
50+
time.sleep(2)
51+
driver.find_element(by=By.CLASS_NAME, value="jobs-s-apply").click()
52+
finally:
53+
jobs_available.remove(jobs_available[posting_num])
54+
try:
55+
time.sleep(3)
56+
driver.find_element(by=By.CSS_SELECTOR, value='[aria-label="Continue to next step"]').click()
57+
time.sleep(3)
58+
driver.find_element(by=By.CSS_SELECTOR, value='[aria-label="Continue to next step"]').click()
59+
time.sleep(15)
60+
driver.find_element(by=By.CSS_SELECTOR, value='[aria-label="Review your application"]').click()
61+
time.sleep(3)
62+
driver.find_element(by=By.CSS_SELECTOR, value='[aria-label="Submit application"]').click()
63+
except NoSuchElementException:
64+
print('Cannot apply, skipped')
65+
print("Work complete")

0 commit comments

Comments
 (0)