working app
This commit is contained in:
parent
8e69e30387
commit
3057cda8d3
12 changed files with 708 additions and 232 deletions
|
|
@ -119,8 +119,47 @@ class WBMHandler(BaseHandler):
|
|||
logger.info("[WBM] Clicking application button...")
|
||||
await apply_btn.click()
|
||||
await asyncio.sleep(2)
|
||||
result["success"] = True
|
||||
result["message"] = "Application button clicked on detail page. (Submission not implemented)"
|
||||
# --- Post-click confirmation logic ---
|
||||
logger.info("[WBM] Clicked application button, checking for confirmation...")
|
||||
# Save screenshot and HTML after click
|
||||
try:
|
||||
await page.screenshot(path="data/wbm_after_apply.png")
|
||||
logger.info("[WBM] Saved screenshot after application click.")
|
||||
except Exception as e:
|
||||
logger.warning(f"[WBM] Could not save screenshot: {e}")
|
||||
try:
|
||||
html_after = await page.content()
|
||||
with open("data/wbm_after_apply.html", "w", encoding="utf-8") as f:
|
||||
f.write(html_after)
|
||||
logger.info("[WBM] Saved HTML after application click.")
|
||||
except Exception as e:
|
||||
logger.warning(f"[WBM] Could not save HTML after apply: {e}")
|
||||
|
||||
# Look for confirmation message on the page
|
||||
confirmation_selectors = [
|
||||
'text="Vielen Dank"',
|
||||
'text="Ihre Anfrage wurde gesendet"',
|
||||
'text="Bestätigung"',
|
||||
'div:has-text("Vielen Dank")',
|
||||
'div:has-text("Ihre Anfrage wurde gesendet")',
|
||||
]
|
||||
confirmed = False
|
||||
for sel in confirmation_selectors:
|
||||
try:
|
||||
el = await page.query_selector(sel)
|
||||
if el and await el.is_visible():
|
||||
logger.info(f"[WBM] Found confirmation element: {sel}")
|
||||
confirmed = True
|
||||
break
|
||||
except Exception as e:
|
||||
logger.debug(f"[WBM] Error checking confirmation selector {sel}: {e}")
|
||||
if confirmed:
|
||||
result["success"] = True
|
||||
result["message"] = "Application submitted and confirmation detected."
|
||||
else:
|
||||
logger.warning("[WBM] No confirmation message detected after application click.")
|
||||
result["success"] = False
|
||||
result["message"] = "Clicked application button, but no confirmation detected. Check screenshot and HTML."
|
||||
else:
|
||||
result["message"] = "No application button found on detail page."
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue