radio fixed
This commit is contained in:
parent
660bb63f04
commit
668135d669
@ -215,7 +215,8 @@ class LinkedInEasyApplier:
|
||||
return False
|
||||
|
||||
def _find_and_handle_radio_question(self, section: WebElement) -> bool:
|
||||
radios = section.find_elements(By.CLASS_NAME, 'fb-text-selectable__option')
|
||||
question = section.find_element(By.CLASS_NAME, 'jobs-easy-apply-form-element')
|
||||
radios = question.find_elements(By.CLASS_NAME, 'fb-text-selectable__option')
|
||||
if radios:
|
||||
question_text = section.text.lower()
|
||||
options = [radio.text.lower() for radio in radios]
|
||||
@ -224,6 +225,7 @@ class LinkedInEasyApplier:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _find_and_handle_textbox_question(self, section: WebElement) -> bool:
|
||||
text_fields = section.find_elements(By.TAG_NAME, 'input') + section.find_elements(By.TAG_NAME, 'textarea')
|
||||
if text_fields:
|
||||
@ -271,9 +273,10 @@ class LinkedInEasyApplier:
|
||||
|
||||
def _select_radio(self, radios: List[WebElement], answer: str) -> None:
|
||||
for radio in radios:
|
||||
if radio.text.lower() == answer.lower():
|
||||
radio.click()
|
||||
break
|
||||
if answer in radio.text.lower():
|
||||
radio.find_element(By.TAG_NAME, 'label').click()
|
||||
return
|
||||
radios[-1].find_element(By.TAG_NAME, 'label').click()
|
||||
|
||||
def _select_dropdown_option(self, element: WebElement, text: str) -> None:
|
||||
select = Select(element)
|
||||
|
@ -145,16 +145,16 @@ class LinkedInJobManager:
|
||||
|
||||
|
||||
def write_to_file(self, job, file_name):
|
||||
pdf_path = Path(job.pdf_path).as_uri()
|
||||
data = {
|
||||
"company": job.company,
|
||||
"job_title": job.title,
|
||||
"link": job.link,
|
||||
"job_location": job.location,
|
||||
"pdf_path": job.pdf_path
|
||||
"pdf_path": pdf_path
|
||||
}
|
||||
file_path = self.output_file_directory / f"{file_name}.json"
|
||||
if not file_path.exists():
|
||||
job.pdf_path = file_path.as_posix()
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
json.dump([data], f, indent=4)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user