Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip invisible iframe #870

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions skyvern/webeye/scraper/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,19 @@ async def get_frame_text(iframe: Frame) -> str:
if child_frame.is_detached():
continue

try:
child_frame_element = await child_frame.frame_element()
except Exception:
LOG.warning(
"Unable to get child_frame_element",
exc_info=True,
)
continue

# it will get stuck when we `frame.evaluate()` on an invisible iframe
if not await child_frame_element.is_visible():
continue

text += await get_frame_text(child_frame)

return text
Expand Down Expand Up @@ -341,6 +354,10 @@ async def get_interactable_element_tree_in_frame(
)
continue

# it will get stuck when we `frame.evaluate()` on an invisible iframe
if not await frame_element.is_visible():
continue

unique_id = await frame_element.get_attribute("unique_id")

frame_js_script = f"() => buildTreeFromBody('{unique_id}')"
Expand Down
Loading