Skip to content

Commit

Permalink
Fixed bugs on this
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbbb committed Nov 27, 2024
1 parent 83b2205 commit 9a19729
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/ai_hawk/linkedIn_easy_applier.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ def fill_up(self, job_context : JobContext) -> None:
".//div[contains(@class, 'fb-dash-form-element')]"
)
logger.debug(f"Found {len(input_elements)} form elements")


for index, element in enumerate(input_elements, start=1):
try:
Expand All @@ -414,7 +415,7 @@ def _process_form_element(self, element: WebElement, job_context : JobContext) -
if self._is_upload_field(element):
self._handle_upload_fields(element, job_context)
else:
self._fill_additional_questions(job_context)
self._fill_additional_questions(element,job_context)

def _handle_dropdown_fields(self, element: WebElement) -> None:
logger.debug("Handling dropdown fields")
Expand Down Expand Up @@ -693,15 +694,9 @@ def split_text_by_width(text, font, font_size, max_width):
logger.error(f"Cover letter upload failed: {tb_str}")
raise Exception(f"Upload failed: \nTraceback:\n{tb_str}")

def _fill_additional_questions(self, job_context : JobContext) -> None:
def _fill_additional_questions(self, element: WebElement, job_context : JobContext) -> None:
logger.debug("Filling additional questions")
form_sections = self.driver.find_elements(
By.XPATH,
".//div[contains(@class, 'fb-dash-form-element')]"
)

for section in form_sections:
self._process_form_section(job_context,section)
self._process_form_section(job_context,element)

def _process_form_section(self,job_context : JobContext, section: WebElement) -> None:
logger.debug("Processing form section")
Expand Down Expand Up @@ -748,7 +743,7 @@ def _find_and_handle_radio_question(self, job_context: JobContext, section: WebE
for radio in radios:
label = section.find_element(By.CSS_SELECTOR, f"label[for='{radio.get_attribute('id')}']")
options.append(label.text.strip().lower())

logger.debug(f"Found radio options: {options}")

question_text = section.text.lower()
Expand Down

0 comments on commit 9a19729

Please sign in to comment.