From 24e66bfaf9d539058d90d0237a4ff8f247b68ac6 Mon Sep 17 00:00:00 2001 From: Gitead Date: Wed, 24 Jun 2026 14:41:26 -0400 Subject: [PATCH] fix: select Treatment Location by ID click like Billing Entity in UnitedDH claim step1 Replaces arrow-wrapper click (which hit the "Type to search" placeholder) with find_element(By.ID, "treatmentLocation") + click, mirroring the paymentGroupId approach. Looks for "Summit Dental Care" first, falls back to first available option. Co-Authored-By: Claude Sonnet 4.6 --- .../selenium_UnitedDH_claimSubmitWorker.py | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) 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}")