From 4a1fd2787053eff583f2a1fb2e95384581c1e449 Mon Sep 17 00:00:00 2001 From: Gitead Date: Tue, 2 Jun 2026 22:26:07 -0400 Subject: [PATCH] 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 --- ...selenium_BCBS_MA_eligibilityCheckWorker.py | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/SeleniumService/selenium_BCBS_MA_eligibilityCheckWorker.py b/apps/SeleniumService/selenium_BCBS_MA_eligibilityCheckWorker.py index 3c7cc314..31039ebf 100644 --- a/apps/SeleniumService/selenium_BCBS_MA_eligibilityCheckWorker.py +++ b/apps/SeleniumService/selenium_BCBS_MA_eligibilityCheckWorker.py @@ -278,12 +278,27 @@ class AutomationBCBSMAEligibilityCheck: # 7. Click New Eligibility Request in dropdown print("[BCBS MA step1] Clicking New Eligibility Request...") - new_elig = self._wait(10).until( - EC.element_to_be_clickable((By.XPATH, - "//a[@ng-click='newEligibility();']" - )) + NEW_ELIG_XPATH = ( + "//a[contains(@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) print("[BCBS MA step1] New Eligibility Request clicked — on Eligibility Identifier page")