safeScrollToTop (#2030)

This commit is contained in:
Shuchang Zheng
2025-03-27 00:47:01 -07:00
committed by GitHub
parent e122821878
commit 0ed236f092
2 changed files with 2 additions and 2 deletions

View File

@@ -1962,7 +1962,7 @@ function safeWindowScroll(x, y) {
} }
} }
async function scrollToTop( async function safeScrollToTop(
draw_boxes, draw_boxes,
frame = "main.frame", frame = "main.frame",
frame_index = undefined, frame_index = undefined,

View File

@@ -204,7 +204,7 @@ class SkyvernFrame:
:param page: Page instance to take the screenshot from. :param page: Page instance to take the screenshot from.
:return: Screenshot of the page. :return: Screenshot of the page.
""" """
js_script = "async ([draw_boxes, frame, frame_index]) => await scrollToTop(draw_boxes, frame, frame_index)" js_script = "async ([draw_boxes, frame, frame_index]) => await safeScrollToTop(draw_boxes, frame, frame_index)"
scroll_y_px = await self.evaluate( scroll_y_px = await self.evaluate(
frame=self.frame, frame=self.frame,
expression=js_script, expression=js_script,