Skip to content

Commit

Permalink
added detection for country code field which was previously defaulted…
Browse files Browse the repository at this point in the history
… to first option element under the select element
  • Loading branch information
Fardin committed Oct 15, 2024
1 parent 3fec2aa commit bc5e5a3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/aihawk_easy_applier.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ def _handle_dropdown_fields(self, element: WebElement) -> None:

dropdown = element.find_element(By.TAG_NAME, 'select')
select = Select(dropdown)
dropdown_id = dropdown.get_attribute('id')
if 'phoneNumber-Country' in dropdown_id:
country = self.resume_generator_manager.get_resume_country()
if country:
try:
select.select_by_value(country)
logger.debug(f"Selected phone country: {country}")
return True
except NoSuchElementException:
logger.warning(f"Country {country} not found in dropdown options")

options = [option.text for option in select.options]
logger.debug(f"Dropdown options found: {options}")
Expand All @@ -371,7 +381,6 @@ def _handle_dropdown_fields(self, element: WebElement) -> None:
if existing_answer:
logger.debug(f"Found existing answer for question '{question_text}': {existing_answer}")
else:

logger.debug(f"No existing answer found, querying model for: {question_text}")
existing_answer = self.gpt_answerer.answer_question_from_options(question_text, options)
logger.debug(f"Model provided answer: {existing_answer}")
Expand Down

0 comments on commit bc5e5a3

Please sign in to comment.