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 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 14:41:26 -04:00
parent 528a30efc6
commit 24e66bfaf9

View File

@@ -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}")