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)
|
||||
print(f"[UnitedDH PreAuth] step9: Status & History URL: {self.driver.current_url}")
|
||||
|
||||
# Wait for table rows with actual data (not just headers)
|
||||
try:
|
||||
WebDriverWait(self.driver, 20).until(
|
||||
EC.presence_of_element_located((By.XPATH, "//table//tr[td]"))
|
||||
)
|
||||
# Wait for table rows with actual data (not just headers). The list loads
|
||||
# asynchronously and can take a while to populate, so poll for a good
|
||||
# while (up to ~75s total) instead of giving up after one short wait.
|
||||
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)
|
||||
except Exception:
|
||||
print("[UnitedDH PreAuth] step9: Table rows did not appear — proceeding with body scan")
|
||||
else:
|
||||
print("[UnitedDH PreAuth] step9: Table rows did not appear after 75s — proceeding with body scan")
|
||||
|
||||
preauth_number = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user