is_numeric fixed
This commit is contained in:
parent
af41201b4f
commit
78d0a8ebca
@ -253,9 +253,12 @@ class LinkedInEasyApplier:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _is_numeric_field(self, element: WebElement) -> bool:
|
def _is_numeric_field(self, field: WebElement) -> bool:
|
||||||
input_type = element.get_attribute('type')
|
field_type = field.get_attribute('type').lower()
|
||||||
return input_type == 'number'
|
if 'numeric' in field_type:
|
||||||
|
return True
|
||||||
|
class_attribute = field.get_attribute("id")
|
||||||
|
return class_attribute and 'numeric' in class_attribute
|
||||||
|
|
||||||
def _enter_text(self, element: WebElement, text: str) -> None:
|
def _enter_text(self, element: WebElement, text: str) -> None:
|
||||||
element.clear()
|
element.clear()
|
||||||
|
@ -115,37 +115,34 @@ class LinkedInJobManager:
|
|||||||
|
|
||||||
def apply_jobs(self):
|
def apply_jobs(self):
|
||||||
try:
|
try:
|
||||||
try:
|
no_jobs_element = self.driver.find_element(By.CLASS_NAME, 'jobs-search-two-pane__no-results-banner--expand')
|
||||||
no_jobs_element = self.driver.find_element(By.CLASS_NAME, 'jobs-search-two-pane__no-results-banner--expand')
|
if 'No matching jobs found' in no_jobs_element.text or 'unfortunately, things aren' in self.driver.page_source.lower():
|
||||||
if 'No matching jobs found' in no_jobs_element.text or 'unfortunately, things aren' in self.driver.page_source.lower():
|
raise Exception("No more jobs on this page")
|
||||||
raise Exception("No more jobs on this page")
|
except NoSuchElementException:
|
||||||
except NoSuchElementException:
|
pass
|
||||||
pass
|
|
||||||
|
|
||||||
job_results = self.driver.find_element(By.CLASS_NAME, "jobs-search-results-list")
|
|
||||||
utils.scroll_slow(self.driver, job_results)
|
|
||||||
utils.scroll_slow(self.driver, job_results, step=300, reverse=True)
|
|
||||||
job_list_elements = self.driver.find_elements(By.CLASS_NAME, 'scaffold-layout__list-container')[0].find_elements(By.CLASS_NAME, 'jobs-search-results__list-item')
|
|
||||||
if not job_list_elements:
|
|
||||||
raise Exception("No job class elements found on page")
|
|
||||||
job_list = [Job(*self.extract_job_information_from_tile(job_element)) for job_element in job_list_elements]
|
|
||||||
for job in job_list:
|
|
||||||
if self.is_blacklisted(job.title, job.company, job.link):
|
|
||||||
utils.printyellow(f"Blacklisted {job.title} at {job.company}, skipping...")
|
|
||||||
self.write_to_file(job, "skipped")
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
if job.apply_method not in {"Continue", "Applied", "Apply"}:
|
|
||||||
self.easy_applier_component.job_apply(job)
|
|
||||||
self.write_to_file(job, "success")
|
|
||||||
except Exception as e:
|
|
||||||
utils.printred(traceback.format_exc())
|
|
||||||
self.write_to_file(job, "failed")
|
|
||||||
continue
|
|
||||||
|
|
||||||
except Exception as e:
|
job_results = self.driver.find_element(By.CLASS_NAME, "jobs-search-results-list")
|
||||||
traceback.format_exc()
|
utils.scroll_slow(self.driver, job_results)
|
||||||
raise e
|
utils.scroll_slow(self.driver, job_results, step=300, reverse=True)
|
||||||
|
job_list_elements = self.driver.find_elements(By.CLASS_NAME, 'scaffold-layout__list-container')[0].find_elements(By.CLASS_NAME, 'jobs-search-results__list-item')
|
||||||
|
if not job_list_elements:
|
||||||
|
raise Exception("No job class elements found on page")
|
||||||
|
job_list = [Job(*self.extract_job_information_from_tile(job_element)) for job_element in job_list_elements]
|
||||||
|
for job in job_list:
|
||||||
|
if self.is_blacklisted(job.title, job.company, job.link):
|
||||||
|
utils.printyellow(f"Blacklisted {job.title} at {job.company}, skipping...")
|
||||||
|
self.write_to_file(job, "skipped")
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
if job.apply_method not in {"Continue", "Applied", "Apply"}:
|
||||||
|
self.easy_applier_component.job_apply(job)
|
||||||
|
self.write_to_file(job, "success")
|
||||||
|
except Exception as e:
|
||||||
|
utils.printred(traceback.format_exc())
|
||||||
|
self.write_to_file(job, "failed")
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def write_to_file(self, job, file_name):
|
def write_to_file(self, job, file_name):
|
||||||
data = {
|
data = {
|
||||||
@ -156,6 +153,7 @@ class LinkedInJobManager:
|
|||||||
"pdf_path": job.pdf_path
|
"pdf_path": job.pdf_path
|
||||||
}
|
}
|
||||||
file_path = self.output_file_directory / f"{file_name}.json"
|
file_path = self.output_file_directory / f"{file_name}.json"
|
||||||
|
file_path = file_path.as_posix()
|
||||||
if not file_path.exists():
|
if not file_path.exists():
|
||||||
with open(file_path, 'w', encoding='utf-8') as f:
|
with open(file_path, 'w', encoding='utf-8') as f:
|
||||||
json.dump([data], f, indent=4)
|
json.dump([data], f, indent=4)
|
||||||
|
Loading…
Reference in New Issue
Block a user