fix: United SCO provider/location page selection + DOB display format

- United SCO eligibility: add Treatment Location step before Billing Entity
  on Provider & Location page; both use ng-arrow-wrapper ActionChains click
  + ARROW_DOWN/ENTER keyboard selection to handle upward-opening panels
- Use visibility_of_element_located for Billing Entity label wait so code
  waits for page to fully render after Select Insurance modal closes
- DOB (and all dates) now display as MM/DD/YYYY instead of Mon DD, YYYY

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
ff
2026-05-29 18:04:16 -04:00
parent 0b7b12eb4c
commit c952f79853
2 changed files with 61 additions and 31 deletions

View File

@@ -702,45 +702,77 @@ class AutomationUnitedSCOEligibilityCheck:
except TimeoutException:
print("[UnitedSCO step1] Select Insurance popup not found — proceeding")
# Step 1.5: Provider & Location page — select Treatment Location (first dropdown),
# page auto-fills the rest, then click Continue
# Step 1.5: Provider & Location page — select Billing Entity dropdown (paymentGroupId),
# choose the only available option, then click Continue
print("[UnitedSCO step1] Waiting for Provider & Location page...")
try:
# Wait for the Continue button to confirm the page loaded
continue_btn2 = WebDriverWait(self.driver, 15).until(
EC.element_to_be_clickable((By.XPATH, "//button[contains(text(),'Continue')]"))
# Wait for the Billing Entity label to be visible — ensures page has fully rendered
WebDriverWait(self.driver, 20).until(
EC.visibility_of_element_located((By.XPATH, "//label[@for='paymentGroupId']"))
)
# Select Treatment Location — click the dropdown and pick the first option;
# the page will auto-fill Billing Entity and other fields automatically
# --- Treatment Location ---
print("[UnitedSCO step1] Selecting Treatment Location...")
location_selected = False
try:
location_ng = self.driver.find_element(By.XPATH,
"//label[contains(text(),'Treatment Location') or contains(text(),'treatment location')]"
"/..//ng-select | "
"(//ng-select)[1]"
)
self.driver.execute_script("arguments[0].scrollIntoView({block:'center'});", location_ng)
time.sleep(0.3)
location_ng.click()
time.sleep(1)
first_option = WebDriverWait(self.driver, 5).until(
location_ng = WebDriverWait(self.driver, 10).until(
EC.element_to_be_clickable((By.XPATH,
"//ng-dropdown-panel//div[contains(@class,'ng-option') and not(contains(@class,'disabled'))]"
"//label[@for='treatmentLocation']/following-sibling::ng-select | "
"//label[@for='treatmentLocation']/..//ng-select"
))
)
self.driver.execute_script("arguments[0].scrollIntoView({block:'end'});", location_ng)
arrow = location_ng.find_element(By.XPATH, ".//span[contains(@class,'ng-arrow-wrapper')]")
ActionChains(self.driver).move_to_element(arrow).click().perform()
WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((By.XPATH, "//ng-dropdown-panel"))
)
first_option = self.driver.find_element(By.XPATH,
"//ng-dropdown-panel//div[contains(@class,'ng-option') and not(contains(@class,'disabled'))]"
)
option_text = first_option.text.strip()
first_option.click()
ActionChains(self.driver).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
print(f"[UnitedSCO step1] Selected Treatment Location: {option_text}")
location_selected = True
time.sleep(1) # wait for page to auto-fill remaining fields
except Exception as e:
print(f"[UnitedSCO step1] Treatment Location selection failed: {e}")
if not location_selected:
print("[UnitedSCO step1] WARNING: Could not select Treatment Location — continuing anyway")
# --- Billing Entity ---
print("[UnitedSCO step1] Selecting Billing Entity...")
billing_selected = False
try:
billing_ng = WebDriverWait(self.driver, 10).until(
EC.element_to_be_clickable((By.XPATH,
"//label[@for='paymentGroupId']/following-sibling::ng-select | "
"//label[@for='paymentGroupId']/..//ng-select"
))
)
self.driver.execute_script("arguments[0].scrollIntoView({block:'end'});", billing_ng)
arrow = billing_ng.find_element(By.XPATH, ".//span[contains(@class,'ng-arrow-wrapper')]")
ActionChains(self.driver).move_to_element(arrow).click().perform()
WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((By.XPATH, "//ng-dropdown-panel"))
)
first_option = self.driver.find_element(By.XPATH,
"//ng-dropdown-panel//div[contains(@class,'ng-option') and not(contains(@class,'disabled'))]"
)
option_text = first_option.text.strip()
ActionChains(self.driver).send_keys(Keys.ARROW_DOWN).send_keys(Keys.ENTER).perform()
print(f"[UnitedSCO step1] Selected Billing Entity: {option_text}")
billing_selected = True
except Exception as e:
print(f"[UnitedSCO step1] Billing Entity selection failed: {e}")
if not billing_selected:
print("[UnitedSCO step1] WARNING: Could not select Billing Entity — continuing anyway")
# Re-find Continue button after location selection to avoid stale element reference
continue_btn2 = WebDriverWait(self.driver, 10).until(
EC.element_to_be_clickable((By.XPATH, "//button[contains(text(),'Continue')]"))
)
continue_btn2.click()
print("[UnitedSCO step1] Clicked Continue button (Provider & Location)")
time.sleep(5)