helper function for wait animation (#3240)

This commit is contained in:
LawyZheng
2025-08-20 14:28:01 +08:00
committed by GitHub
parent 79d9486f92
commit 55bc6bd367
3 changed files with 32 additions and 137 deletions

View File

@@ -555,12 +555,8 @@ async def scrape_web_unsafe(
if url == "about:blank" and not support_empty_page:
raise ScrapingFailedBlankPage()
try:
await page.wait_for_load_state("load", timeout=3000)
skyvern_frame = await SkyvernFrame.create_instance(page)
await skyvern_frame.safe_wait_for_animation_end()
except Exception:
LOG.warning("Failed to wait for load state, will continue scraping", exc_info=True)
skyvern_frame = await SkyvernFrame.create_instance(page)
await skyvern_frame.safe_wait_for_animation_end()
if wait_seconds > 0:
LOG.info(f"Waiting for {wait_seconds} seconds before scraping the website.", wait_seconds=wait_seconds)
@@ -689,15 +685,7 @@ async def add_frame_interactable_elements(
return elements, element_tree
skyvern_frame = await SkyvernFrame.create_instance(frame)
try:
await skyvern_frame.get_frame().wait_for_load_state("load", timeout=3000)
await skyvern_frame.safe_wait_for_animation_end()
except Exception:
LOG.warning(
"Failed to wait for load state or animation end for the frame, will continue scraping",
frame_id=unique_id,
exc_info=True,
)
await skyvern_frame.safe_wait_for_animation_end()
frame_elements, frame_element_tree = await skyvern_frame.build_tree_from_body(
frame_name=unique_id, frame_index=frame_index