is_numeric fixed

This commit is contained in:
feder-cr 2024-08-22 16:54:56 +01:00
parent af41201b4f
commit 78d0a8ebca
2 changed files with 34 additions and 33 deletions

View File

@ -253,9 +253,12 @@ class LinkedInEasyApplier:
return True
return False
def _is_numeric_field(self, element: WebElement) -> bool:
input_type = element.get_attribute('type')
return input_type == 'number'
def _is_numeric_field(self, field: WebElement) -> bool:
field_type = field.get_attribute('type').lower()
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:
element.clear()

View File

@ -114,7 +114,6 @@ class LinkedInJobManager:
page_sleep += 1
def apply_jobs(self):
try:
try:
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():
@ -143,9 +142,7 @@ class LinkedInJobManager:
self.write_to_file(job, "failed")
continue
except Exception as e:
traceback.format_exc()
raise e
def write_to_file(self, job, file_name):
data = {
@ -156,6 +153,7 @@ class LinkedInJobManager:
"pdf_path": job.pdf_path
}
file_path = self.output_file_directory / f"{file_name}.json"
file_path = file_path.as_posix()
if not file_path.exists():
with open(file_path, 'w', encoding='utf-8') as f:
json.dump([data], f, indent=4)