Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions linkedin.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ def linkJobApply(self):
countJobs += 1

jobProperties = self.getJobProperties(countJobs)

print("Will extract the easy apply button now")
button = self.easyApplyButton()

print("Button is: ", button)
if button is not False:
print("easy applllly")
button.click()
time.sleep(random.uniform(1, constants.botSpeed))
countApplied += 1
Expand Down Expand Up @@ -143,7 +144,8 @@ def linkJobApply(self):
lineToWrite = jobProperties + " | " + "* 🥵 Cannot apply to this Job! " +str(offerPage)
self.displayWriteResults(lineToWrite)
else:
lineToWrite = jobProperties + " | " + "* 🥳 Already applied! Job: " +str(offerPage)
print("Button not found")
lineToWrite = jobProperties + " | " + "* 🥵 Unable to apply! Job: " +str(offerPage)
self.displayWriteResults(lineToWrite)


Expand All @@ -162,32 +164,32 @@ def getJobProperties(self, count):
jobApplications = ""

try:
jobTitle = self.driver.find_element(By.XPATH,"//h1[contains(@class, 'job-title')]").get_attribute("innerHTML").strip()
jobTitle = self.driver.find_element(By.XPATH,"//h1[contains(@class, 't-24 t-bold inline')]").get_attribute("innerHTML").strip()
except Exception as e:
prYellow("Warning in getting jobTitle: " +str(e)[0:50])
jobTitle = ""
try:
jobCompany = self.driver.find_element(By.XPATH,"//a[contains(@class, 'ember-view t-black t-normal')]").get_attribute("innerHTML").strip()
jobCompany = self.driver.find_element(By.XPATH,"//div[contains(@class, 'job-details-jobs-unified-top-card__company-name')]").get_attribute("innerHTML").strip()
except Exception as e:
prYellow("Warning in getting jobCompany: " +str(e)[0:50])
jobCompany = ""
try:
jobLocation = self.driver.find_element(By.XPATH,"//span[contains(@class, 'bullet')]").get_attribute("innerHTML").strip()
jobLocation = self.driver.find_element(By.XPATH,"//span[contains(@class, 'tvm__text tvm__text--low-emphasis')]").get_attribute("innerHTML").strip()
except Exception as e:
prYellow("Warning in getting jobLocation: " +str(e)[0:50])
jobLocation = ""
try:
jobWOrkPlace = self.driver.find_element(By.XPATH,"//span[contains(@class, 'workplace-type')]").get_attribute("innerHTML").strip()
jobWOrkPlace = self.driver.find_element(By.XPATH,"//span[contains(@class, 'job-details-jobs-unified-top-card__job-insight-view-model-secondary')]").get_attribute("innerHTML").strip()
except Exception as e:
prYellow("Warning in getting jobWorkPlace: " +str(e)[0:50])
jobWOrkPlace = ""
try:
jobPostedDate = self.driver.find_element(By.XPATH,"//span[contains(@class, 'posted-date')]").get_attribute("innerHTML").strip()
jobPostedDate = self.driver.find_element(By.XPATH,"//span[contains(@class, 'tvm__text tvm__text--low-emphasis')]").get_attribute("innerHTML").strip()
except Exception as e:
prYellow("Warning in getting jobPostedDate: " +str(e)[0:50])
jobPostedDate = ""
try:
jobApplications= self.driver.find_element(By.XPATH,"//span[contains(@class, 'applicant-count')]").get_attribute("innerHTML").strip()
jobApplications= self.driver.find_element(By.XPATH,"//span[contains(@class, 'tvm__text tvm__text--low-emphasis')]").get_attribute("innerHTML").strip()
except Exception as e:
prYellow("Warning in getting jobApplications: " +str(e)[0:50])
jobApplications = ""
Expand All @@ -197,8 +199,7 @@ def getJobProperties(self, count):

def easyApplyButton(self):
try:
button = self.driver.find_element(By.XPATH,
'//button[contains(@class, "jobs-apply-button")]')
button = self.driver.find_element(By.CSS_SELECTOR, ".jobs-apply-button--top-card")
EasyApplyButton = button
except:
EasyApplyButton = False
Expand Down Expand Up @@ -239,6 +240,7 @@ def displayWriteResults(self,lineToWrite: str):
start = time.time()
while True:
try:
print("Starting program")
Linkedin().linkJobApply()
except Exception as e:
prRed("Error in main: " +str(e))
Expand Down