fix: broaden XPath and add fallback for BCBS MA New Eligibility Request click

The exact ng-click='newEligibility();' XPath was failing to match the link.
Replaced with three alternative patterns (partial ng-click, full text, partial
text), added a JS-click fallback for intercepted clicks, and auto-re-opens the
Verification dropdown if it closes before the link is found.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gitead
2026-06-02 22:26:07 -04:00
parent ddcc49b72c
commit 4a1fd27870

View File

@@ -278,12 +278,27 @@ class AutomationBCBSMAEligibilityCheck:
# 7. Click New Eligibility Request in dropdown # 7. Click New Eligibility Request in dropdown
print("[BCBS MA step1] Clicking New Eligibility Request...") print("[BCBS MA step1] Clicking New Eligibility Request...")
new_elig = self._wait(10).until( NEW_ELIG_XPATH = (
EC.element_to_be_clickable((By.XPATH, "//a[contains(@ng-click,'newEligibility')] | "
"//a[@ng-click='newEligibility();']" "//a[contains(normalize-space(text()),'New Eligibility Request')] | "
)) "//a[contains(normalize-space(text()),'New Eligibility')]"
) )
new_elig.click() try:
new_elig = self._wait(8).until(
EC.presence_of_element_located((By.XPATH, NEW_ELIG_XPATH))
)
except TimeoutException:
# Dropdown may have closed — re-open Verification and try again
print("[BCBS MA step1] New Eligibility Request not found, re-clicking Verification...")
verification.click()
time.sleep(2)
new_elig = self._wait(8).until(
EC.presence_of_element_located((By.XPATH, NEW_ELIG_XPATH))
)
try:
new_elig.click()
except Exception:
self.driver.execute_script("arguments[0].click();", new_elig)
time.sleep(3) time.sleep(3)
print("[BCBS MA step1] New Eligibility Request clicked — on Eligibility Identifier page") print("[BCBS MA step1] New Eligibility Request clicked — on Eligibility Identifier page")