fix: poll longer for Status & History table to load in preauth worker
Status & History page loads results asynchronously; a single 20s wait was giving up before the row appeared, so the pre-auth number was never captured. Now polls up to 75s for a populated row. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1139,14 +1139,24 @@ class AutomationUnitedDHPreAuth:
|
|||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print(f"[UnitedDH PreAuth] step9: Status & History URL: {self.driver.current_url}")
|
print(f"[UnitedDH PreAuth] step9: Status & History URL: {self.driver.current_url}")
|
||||||
|
|
||||||
# Wait for table rows with actual data (not just headers)
|
# Wait for table rows with actual data (not just headers). The list loads
|
||||||
try:
|
# asynchronously and can take a while to populate, so poll for a good
|
||||||
WebDriverWait(self.driver, 20).until(
|
# while (up to ~75s total) instead of giving up after one short wait.
|
||||||
EC.presence_of_element_located((By.XPATH, "//table//tr[td]"))
|
row_deadline = time.time() + 75
|
||||||
)
|
found_rows = False
|
||||||
|
while time.time() < row_deadline:
|
||||||
|
try:
|
||||||
|
rows = self.driver.find_elements(By.XPATH, "//table//tr[td]")
|
||||||
|
if rows and any(r.text.strip() for r in rows):
|
||||||
|
found_rows = True
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
time.sleep(3)
|
||||||
|
if found_rows:
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
except Exception:
|
else:
|
||||||
print("[UnitedDH PreAuth] step9: Table rows did not appear — proceeding with body scan")
|
print("[UnitedDH PreAuth] step9: Table rows did not appear after 75s — proceeding with body scan")
|
||||||
|
|
||||||
preauth_number = None
|
preauth_number = None
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user