diff --git a/apps/SeleniumService/selenium_UnitedDH_claimSubmitWorker.py b/apps/SeleniumService/selenium_UnitedDH_claimSubmitWorker.py index 92eb449a..e9e1846c 100644 --- a/apps/SeleniumService/selenium_UnitedDH_claimSubmitWorker.py +++ b/apps/SeleniumService/selenium_UnitedDH_claimSubmitWorker.py @@ -585,22 +585,34 @@ class AutomationUnitedDHClaimSubmit: print("[UnitedDH Claim] step1: Selecting Treatment Location...") location_selected = False try: - location_ng = WebDriverWait(self.driver, 10).until( - EC.element_to_be_clickable((By.XPATH, - "//label[@for='treatmentLocation']/following-sibling::ng-select | " - "//label[@for='treatmentLocation']/..//ng-select" - )) - ) - self.driver.execute_script("arguments[0].scrollIntoView({block:'center'});", location_ng) - arrow = location_ng.find_element(By.CSS_SELECTOR, ".ng-arrow-wrapper") - arrow.click() - first_option = WebDriverWait(self.driver, 5).until( - EC.element_to_be_clickable((By.CSS_SELECTOR, ".ng-dropdown-panel .ng-option")) - ) - option_text = first_option.text.strip() - first_option.click() - print(f"[UnitedDH Claim] step1: Selected Treatment Location: {option_text}") - location_selected = True + location_input = self.driver.find_element(By.ID, "treatmentLocation") + if location_input.is_displayed(): + self.driver.execute_script("arguments[0].scrollIntoView({block:'center'});", location_input) + location_input.click() + print("[UnitedDH Claim] step1: Clicked Treatment Location dropdown") + time.sleep(1) + try: + summit_option = WebDriverWait(self.driver, 5).until( + EC.element_to_be_clickable((By.XPATH, + "//ng-dropdown-panel//div[contains(@class,'ng-option') and contains(.,'Summit Dental Care')]" + )) + ) + summit_option.click() + print("[UnitedDH Claim] step1: Selected Treatment Location: Summit Dental Care") + location_selected = True + except TimeoutException: + try: + first_option = self.driver.find_element(By.XPATH, + "//ng-dropdown-panel//div[contains(@class,'ng-option')]" + ) + option_text = first_option.text.strip() + first_option.click() + print(f"[UnitedDH Claim] step1: Selected Treatment Location (fallback): {option_text}") + location_selected = True + except Exception: + print("[UnitedDH Claim] step1: No options available in Treatment Location dropdown") + ActionChains(self.driver).send_keys(Keys.ESCAPE).perform() + time.sleep(1) except Exception as e: print(f"[UnitedDH Claim] step1: Treatment Location selection failed: {e}")