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