Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added detection for country code field which was previously defaulted to first option element under the select element #544

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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