From f9cc024086a873ff6bcd89138cb4d73002f87c0b Mon Sep 17 00:00:00 2001 From: Fardin Date: Tue, 15 Oct 2024 13:44:23 +0530 Subject: [PATCH] added detection for country code field which was previously defaulted to first option element under the select element --- src/aihawk_easy_applier.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/aihawk_easy_applier.py b/src/aihawk_easy_applier.py index 35ec76dab..943814264 100644 --- a/src/aihawk_easy_applier.py +++ b/src/aihawk_easy_applier.py @@ -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}") @@ -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}")