Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
perf(SKY-11099): default scrape to skip visual bounding box overlay (#6654)
LawyZhenge7047891a7da
diff --git a/skyvern/core/script_generations/script_skyvern_page.py b/skyvern/core/script_generations/script_skyvern_page.pyindex 148717881..1862685c9 100644--- a/skyvern/core/script_generations/script_skyvern_page.py+++ b/skyvern/core/script_generations/script_skyvern_page.py@@ -146,7 +146,10 @@ class ScriptSkyvernPage(SkyvernPage):cleanup_element_tree=app.AGENT_FUNCTION.cleanup_element_tree_factory(),scrape_exclude=app.scrape_exclude,max_screenshot_number=settings.MAX_NUM_SCREENSHOTS,- draw_boxes=True,+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # ``draw_boxes`` is wired through the scrape pipeline as False; the overlay helpers+ # are retained briefly for backwards compatibility and scheduled for removal.+ draw_boxes=False,scroll=True,support_empty_page=True,)diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.pyindex 48df0e39c..09e089fd1 100644--- a/skyvern/forge/agent.py+++ b/skyvern/forge/agent.py@@ -3243,11 +3243,13 @@ class ForgeAgent:await browser_state.reload_page(degradation=True)max_screenshot_number = settings.MAX_NUM_SCREENSHOTS- draw_boxes = True+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # ``draw_boxes`` is wired through the scrape pipeline as False; the overlay helpers+ # are retained briefly for backwards compatibility and scheduled for removal.+ draw_boxes = Falsescroll = Trueif engine in CUA_ENGINES:max_screenshot_number = 1- draw_boxes = Falsescroll = Falsereturn await browser_state.scrape_website(diff --git a/skyvern/webeye/browser_state.py b/skyvern/webeye/browser_state.pyindex b906ca1b9..01e0d8842 100644--- a/skyvern/webeye/browser_state.py+++ b/skyvern/webeye/browser_state.py@@ -104,7 +104,10 @@ class BrowserState(Protocol):max_retries: int = settings.MAX_SCRAPING_RETRIES,scrape_exclude: ScrapeExcludeFunc | None = None,take_screenshots: bool = True,- draw_boxes: bool = True,+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # The parameter is retained for backwards compatibility and is scheduled for removal.+ # New call sites must not pass ``draw_boxes=True``.+ draw_boxes: bool = False,max_screenshot_number: int = settings.MAX_NUM_SCREENSHOTS,scroll: bool = True,support_empty_page: bool = False,diff --git a/skyvern/webeye/real_browser_state.py b/skyvern/webeye/real_browser_state.pyindex 376d9da32..41f980c4f 100644--- a/skyvern/webeye/real_browser_state.py+++ b/skyvern/webeye/real_browser_state.py@@ -504,7 +504,10 @@ class RealBrowserState(BrowserState):max_retries: int = settings.MAX_SCRAPING_RETRIES,scrape_exclude: ScrapeExcludeFunc | None = None,take_screenshots: bool = True,- draw_boxes: bool = True,+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # The parameter is retained for backwards compatibility and is scheduled for removal.+ # New call sites must not pass ``draw_boxes=True``.+ draw_boxes: bool = False,max_screenshot_number: int = settings.MAX_NUM_SCREENSHOTS,scroll: bool = True,support_empty_page: bool = False,diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.jsindex fa7b127e7..5d983a80e 100644--- a/skyvern/webeye/scraper/domUtils.js+++ b/skyvern/webeye/scraper/domUtils.js@@ -2128,6 +2128,9 @@ async function buildElementTree(return [elements, resultArray];}+// DEPRECATED: visual bounding box overlay is no longer rendered during scraping.+// This helper is retained briefly for backwards compatibility and is scheduled+// for removal; new call sites must not be added.function drawBoundingBoxes(elements) {// draw a red border around the elementsDomUtils.clearVisibleClientRectCache();@@ -2141,6 +2144,9 @@ function drawBoundingBoxes(elements) {DomUtils.clearVisibleClientRectCache();}+// DEPRECATED: visual bounding box overlay is no longer rendered during scraping.+// This helper is retained briefly for backwards compatibility and is scheduled+// for removal; new call sites must not be added.async function buildElementsAndDrawBoundingBoxes(frame = "main.frame",frame_index = undefined,@@ -2381,6 +2387,9 @@ function addHintMarkersToPage(hintMarkers) {document.documentElement.appendChild(parent);}+// DEPRECATED: visual bounding box overlay is no longer rendered during scraping.+// This helper is retained briefly for backwards compatibility and is scheduled+// for removal; new call sites must not be added.function removeBoundingBoxes() {var hintMarkerContainer = document.querySelector("#boundingBoxContainer");// Avoid Element.prototype.remove(): pages that polyfill it Prototype.js-style@@ -2406,7 +2415,12 @@ async function safeScrollToTop(frame = "main.frame",frame_index = undefined,) {- removeBoundingBoxes();+ // The overlay path is deprecated. Skyvern only touches the marker container+ // it has previously inserted; ``draw_boxes=false`` callers must not mutate+ // the target page (e.g. an unrelated page-owned ``#boundingBoxContainer``).+ if (draw_boxes) {+ removeBoundingBoxes();+ }safeWindowScroll(0, 0);if (draw_boxes) {await buildElementsAndDrawBoundingBoxes(frame, frame_index);@@ -2435,9 +2449,12 @@ async function scrollToNextPage(frame_index = undefined,need_overlap = true,) {- // remove bounding boxes, scroll to next page with 200px overlap, then draw bounding boxes again- // return true if there is a next page, false otherwise- removeBoundingBoxes();+ // The overlay path is deprecated. Skyvern only touches the marker container+ // it has previously inserted; ``draw_boxes=false`` callers must not mutate+ // the target page (e.g. an unrelated page-owned ``#boundingBoxContainer``).+ if (draw_boxes) {+ removeBoundingBoxes();+ }window.scrollBy({left: 0,top: need_overlap ? window.innerHeight - 200 : window.innerHeight,diff --git a/skyvern/webeye/scraper/scraped_page.py b/skyvern/webeye/scraper/scraped_page.pyindex 4735669b4..ab3c6d0b5 100644--- a/skyvern/webeye/scraper/scraped_page.py+++ b/skyvern/webeye/scraper/scraped_page.py@@ -459,7 +459,7 @@ class ScrapedPage(BaseModel, ElementTreeBuilder):raise UnknownElementTreeFormat(fmt=fmt)- async def refresh(self, draw_boxes: bool = True, scroll: bool = True, max_retries: int = 0) -> Self:+ async def refresh(self, draw_boxes: bool = False, scroll: bool = True, max_retries: int = 0) -> Self:refreshed_page = await self._browser_state.scrape_website(url=self.url,cleanup_element_tree=self._clean_up_func,@@ -497,7 +497,10 @@ class ScrapedPage(BaseModel, ElementTreeBuilder):async def generate_scraped_page(self,- draw_boxes: bool = True,+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # The parameter is retained for backwards compatibility and is scheduled for removal.+ # New call sites must not pass ``draw_boxes=True``.+ draw_boxes: bool = False,scroll: bool = True,take_screenshots: bool = True,max_retries: int = 0,diff --git a/skyvern/webeye/scraper/scraper.py b/skyvern/webeye/scraper/scraper.pyindex 7210e46f3..906f461e7 100644--- a/skyvern/webeye/scraper/scraper.py+++ b/skyvern/webeye/scraper/scraper.py@@ -195,7 +195,10 @@ async def scrape_website(max_retries: int = settings.MAX_SCRAPING_RETRIES,scrape_exclude: ScrapeExcludeFunc | None = None,take_screenshots: bool = True,- draw_boxes: bool = True,+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # The parameter is retained for backwards compatibility and is scheduled for removal.+ # New call sites must not pass ``draw_boxes=True``.+ draw_boxes: bool = False,max_screenshot_number: int = settings.MAX_NUM_SCREENSHOTS,scroll: bool = True,support_empty_page: bool = False,@@ -379,7 +382,10 @@ async def scrape_web_unsafe(cleanup_element_tree: CleanupElementTreeFunc,scrape_exclude: ScrapeExcludeFunc | None = None,take_screenshots: bool = True,- draw_boxes: bool = True,+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # The parameter is retained for backwards compatibility and is scheduled for removal.+ # New call sites must not pass ``draw_boxes=True``.+ draw_boxes: bool = False,max_screenshot_number: int = settings.MAX_NUM_SCREENSHOTS,scroll: bool = True,support_empty_page: bool = False,diff --git a/skyvern/webeye/utils/page.py b/skyvern/webeye/utils/page.pyindex 929361e35..5fbc837d2 100644--- a/skyvern/webeye/utils/page.py+++ b/skyvern/webeye/utils/page.py@@ -203,8 +203,10 @@ async def _scrolling_screenshots_helper(frame = "main.frame"frame_index = 0- # when mode is lite, we don't draw bounding boxes- # since draw_boxes impacts the performance of processing+ # DEPRECATED: visual bounding box overlays are no longer rendered during scraping.+ # ``draw_boxes`` is False by default for all scrape callers; the ``if draw_boxes:``+ # branches below are retained briefly for backwards compatibility and are+ # scheduled for removal. The LITE-mode override is kept as a defensive guard.if mode == ScreenshotMode.LITE:draw_boxes = Falsediff --git a/tests/unit/test_domutils_deprecated_marker.py b/tests/unit/test_domutils_deprecated_marker.pynew file mode 100644index 000000000..71ab5da8d--- /dev/null+++ b/tests/unit/test_domutils_deprecated_marker.py@@ -0,0 +1,49 @@+"""Source-contract test for the deprecated visual bounding box overlay helpers.++The visual overlay helpers in ``domUtils.js`` are retained briefly for backwards+compatibility and are scheduled for removal. Future cleanup should be+intentional, so this test pins two contracts:++1. The helpers still exist (we have not silently deleted them mid-deprecation).+2. Each helper carries a clear ``DEPRECATED`` marker so the next reader knows+ the path is on its way out.+"""++from __future__ import annotations++from pathlib import Path++_DOM_UTILS = Path(__file__).resolve().parents[2] / "skyvern" / "webeye" / "scraper" / "domUtils.js"+++DEPRECATED_OVERLAY_HELPERS = (+ "drawBoundingBoxes",+ "buildElementsAndDrawBoundingBoxes",+ "removeBoundingBoxes",+)+++def _function_decl_line(source_lines: list[str], helper: str) -> int:+ """Return 1-based line number of the helper's ``function`` declaration."""++ for idx, line in enumerate(source_lines):+ if f"function {helper}(" in line:+ return idx + 1+ raise AssertionError(f"could not find function declaration for {helper}() in domUtils.js")+++def test_deprecated_overlay_helpers_still_present() -> None:+ source = _DOM_UTILS.read_text()+ for helper in DEPRECATED_OVERLAY_HELPERS:+ assert f"function {helper}(" in source, f"{helper} was unexpectedly removed before its scheduled cleanup"+++def test_deprecated_overlay_helpers_have_marker_comment() -> None:+ source_lines = _DOM_UTILS.read_text().splitlines()+ for helper in DEPRECATED_OVERLAY_HELPERS:+ decl_line = _function_decl_line(source_lines, helper)+ # Look at the 6 lines preceding the declaration for a DEPRECATED marker.+ preceding = source_lines[max(0, decl_line - 7) : decl_line - 1]+ assert any("DEPRECATED" in line for line in preceding), (+ f"{helper}() must carry a DEPRECATED marker in the preceding comment block; checked lines: {preceding!r}"+ )diff --git a/tests/unit/test_domutils_scroll_helpers_gating.py b/tests/unit/test_domutils_scroll_helpers_gating.pynew file mode 100644index 000000000..1d23ab50c--- /dev/null+++ b/tests/unit/test_domutils_scroll_helpers_gating.py@@ -0,0 +1,124 @@+"""JS-source contract: scroll helpers must not touch overlay code when draw_boxes is false.++This complements ``test_scrolling_screenshots_skip_overlay`` (which stubs the+Python side). Here we parse the real ``domUtils.js`` source and assert that+every overlay helper call inside ``safeScrollToTop`` and ``scrollToNextPage``+is nested inside an ``if (draw_boxes) { ... }`` branch. Without this gate, the+default ``draw_boxes=false`` path would still call ``removeBoundingBoxes()`` and+could mutate a target page that happens to own a ``#boundingBoxContainer``.+"""++from __future__ import annotations++from pathlib import Path++_DOM_UTILS = Path(__file__).resolve().parents[2] / "skyvern" / "webeye" / "scraper" / "domUtils.js"++# Helpers that must only fire on the overlay path.+_OVERLAY_HELPERS = (+ "removeBoundingBoxes",+ "buildElementsAndDrawBoundingBoxes",+ "drawBoundingBoxes",+)++# Scroll helpers whose default callers reach with draw_boxes=false.+_SCROLL_HELPERS = ("safeScrollToTop", "scrollToNextPage")+++def _extract_function_body(source: str, fn_name: str) -> str:+ """Return the source of ``async function <fn_name>(...) { ... }``.++ Brace-matches from the first ``{`` after the declaration to the balanced+ closing ``}``. This is sufficient for the hand-written scroll helpers and+ keeps the test self-contained (no JS parser dependency).+ """++ needle = f"async function {fn_name}("+ start = source.find(needle)+ assert start != -1, f"could not find async function {fn_name}() in domUtils.js"++ brace_start = source.find("{", start)+ assert brace_start != -1, f"could not find opening brace for {fn_name}()"++ depth = 0+ for idx in range(brace_start, len(source)):+ ch = source[idx]+ if ch == "{":+ depth += 1+ elif ch == "}":+ depth -= 1+ if depth == 0:+ return source[brace_start : idx + 1]++ raise AssertionError(f"unbalanced braces in {fn_name}() body")+++def _scopes_inside_if_draw_boxes(body: str) -> list[tuple[int, int]]:+ """Return [(open_index, close_index)] ranges for each ``if (draw_boxes) {...}`` block."""++ needle = "if (draw_boxes) {"+ ranges: list[tuple[int, int]] = []+ cursor = 0+ while True:+ loc = body.find(needle, cursor)+ if loc == -1:+ return ranges+ brace_open = loc + len(needle) - 1+ depth = 0+ for idx in range(brace_open, len(body)):+ ch = body[idx]+ if ch == "{":+ depth += 1+ elif ch == "}":+ depth -= 1+ if depth == 0:+ ranges.append((brace_open, idx))+ cursor = idx + 1+ break+ else:+ raise AssertionError("unbalanced braces inside if (draw_boxes) block")+++def _call_sites(body: str, helper: str) -> list[int]:+ """Locations of ``<helper>(`` calls inside ``body``."""++ needle = f"{helper}("+ locs: list[int] = []+ cursor = 0+ while True:+ loc = body.find(needle, cursor)+ if loc == -1:+ return locs+ locs.append(loc)+ cursor = loc + len(needle)+++def test_scroll_helpers_gate_overlay_calls_under_draw_boxes() -> None:+ source = _DOM_UTILS.read_text()+ failures: list[str] = []++ for fn_name in _SCROLL_HELPERS:+ body = _extract_function_body(source, fn_name)+ gated_ranges = _scopes_inside_if_draw_boxes(body)+ for helper in _OVERLAY_HELPERS:+ for call_idx in _call_sites(body, helper):+ if not any(open_idx < call_idx < close_idx for open_idx, close_idx in gated_ranges):+ failures.append(+ f"{fn_name}() invokes {helper}() outside an `if (draw_boxes)` block "+ f"(offset {call_idx} in function body)"+ )++ assert not failures, "Overlay helpers must only run when draw_boxes is true:\n" + "\n".join(failures)+++def test_default_scrape_pipeline_passes_draw_boxes_false_to_scroll_helpers() -> None:+ """Sanity check the Python -> JS argument passing matches the gated contract."""++ page_src = (Path(__file__).resolve().parents[2] / "skyvern" / "webeye" / "utils" / "page.py").read_text()++ # Both scroll wrappers exist and forward draw_boxes verbatim into the JS expression.+ assert "safeScrollToTop(draw_boxes, frame, frame_index)" in page_src+ assert "scrollToNextPage(draw_boxes, frame, frame_index, need_overlap)" in page_src++ # And the helper that orchestrates the scroll loop defaults to False.+ assert "draw_boxes: bool = False" in page_srcdiff --git a/tests/unit/test_scrape_default_no_overlay.py b/tests/unit/test_scrape_default_no_overlay.pynew file mode 100644index 000000000..1598963cf--- /dev/null+++ b/tests/unit/test_scrape_default_no_overlay.py@@ -0,0 +1,87 @@+"""Pin the visual bounding box overlay opt-in default to False across scrape entry points.++Visual bounding box overlay rendering is being phased out; the corresponding+``draw_boxes`` parameter is retained briefly for backwards compatibility and+should default to False everywhere. This file uses ``inspect`` to read live+function signatures so the defaults cannot silently drift back to True.+"""++from __future__ import annotations++import ast+import inspect+from pathlib import Path++from skyvern.webeye.browser_state import BrowserState+from skyvern.webeye.real_browser_state import RealBrowserState+from skyvern.webeye.scraper.scraped_page import ScrapedPage+from skyvern.webeye.scraper.scraper import scrape_web_unsafe, scrape_website+++def _draw_boxes_default(fn) -> object:+ sig = inspect.signature(fn)+ assert "draw_boxes" in sig.parameters, f"{fn.__qualname__} is missing the draw_boxes parameter"+ return sig.parameters["draw_boxes"].default+++def test_scrape_website_default_is_false() -> None:+ assert _draw_boxes_default(scrape_website) is False+++def test_scrape_web_unsafe_default_is_false() -> None:+ assert _draw_boxes_default(scrape_web_unsafe) is False+++def test_browser_state_scrape_website_default_is_false() -> None:+ assert _draw_boxes_default(BrowserState.scrape_website) is False+++def test_real_browser_state_scrape_website_default_is_false() -> None:+ assert _draw_boxes_default(RealBrowserState.scrape_website) is False+++def test_scraped_page_refresh_default_is_false() -> None:+ assert _draw_boxes_default(ScrapedPage.refresh) is False+++def test_scraped_page_generate_scraped_page_default_is_false() -> None:+ assert _draw_boxes_default(ScrapedPage.generate_scraped_page) is False+++_AGENT_FILE = Path(__file__).resolve().parents[2] / "skyvern" / "forge" / "agent.py"+_SCRIPT_PAGE_FILE = (+ Path(__file__).resolve().parents[2] / "skyvern" / "core" / "script_generations" / "script_skyvern_page.py"+)+++def test_agent_does_not_assign_draw_boxes_true() -> None:+ """``ForgeAgent`` callers must not flip ``draw_boxes`` back to True."""++ tree = ast.parse(_AGENT_FILE.read_text())+ offenders: list[int] = []+ for node in ast.walk(tree):+ if isinstance(node, ast.Assign):+ for target in node.targets:+ if isinstance(target, ast.Name) and target.id == "draw_boxes":+ if isinstance(node.value, ast.Constant) and node.value.value is True:+ offenders.append(node.lineno)+ assert offenders == [], (+ f"agent.py assigns draw_boxes = True at lines {offenders}; "+ "the overlay is deprecated and these assignments must be False."+ )+++def test_script_skyvern_page_does_not_pass_draw_boxes_true() -> None:+ """Cached-script scrape entry must not pass ``draw_boxes=True``."""++ tree = ast.parse(_SCRIPT_PAGE_FILE.read_text())+ offenders: list[int] = []+ for node in ast.walk(tree):+ if isinstance(node, ast.Call):+ for kw in node.keywords:+ if kw.arg == "draw_boxes" and isinstance(kw.value, ast.Constant) and kw.value.value is True:+ offenders.append(node.lineno)+ assert offenders == [], (+ f"script_skyvern_page.py passes draw_boxes=True at lines {offenders}; "+ "the overlay is deprecated and these call sites must be False."+ )diff --git a/tests/unit/test_scrolling_screenshots_skip_overlay.py b/tests/unit/test_scrolling_screenshots_skip_overlay.pynew file mode 100644index 000000000..674e5c3e6--- /dev/null+++ b/tests/unit/test_scrolling_screenshots_skip_overlay.py@@ -0,0 +1,129 @@+"""Default scrape callers must not invoke visual bounding box helpers.++Exercises ``_scrolling_screenshots_helper`` with ``draw_boxes=False`` (the new+default) and asserts that no overlay build/remove call lands on the page.+"""++from __future__ import annotations++from unittest.mock import AsyncMock, MagicMock, patch++import pytest++import skyvern.webeye.utils.page as page_module+from skyvern.webeye.utils.page import ScreenshotMode+++class _StubSkyvernFrame:+ """In-memory stand-in for SkyvernFrame that records every call."""++ def __init__(self, scroll_steps: list[float], scroll_heights: list[int]) -> None:+ self._scroll_steps = list(scroll_steps)+ self._scroll_heights = list(scroll_heights)+ self.calls: list[str] = []++ async def is_window_scrollable(self) -> bool:+ return True++ async def get_scroll_width_and_height(self) -> tuple[int, int]:+ height = self._scroll_heights.pop(0) if self._scroll_heights else 1000+ return (800, height)++ async def scroll_to_top(self, *, draw_boxes: bool, frame: str, frame_index: int) -> float:+ self.calls.append(f"scroll_to_top(draw_boxes={draw_boxes})")+ return self._scroll_steps.pop(0) if self._scroll_steps else 0.0++ async def scroll_to_next_page(+ self,+ *,+ draw_boxes: bool,+ frame: str,+ frame_index: int,+ need_overlap: bool = True,+ ) -> float:+ self.calls.append(f"scroll_to_next_page(draw_boxes={draw_boxes})")+ return self._scroll_steps.pop(0) if self._scroll_steps else 0.0++ async def build_tree_from_body(self, frame_name: str, frame_index: int) -> None:+ self.calls.append("build_tree_from_body")++ async def safe_wait_for_animation_end(self, caller: str) -> None:+ self.calls.append(f"safe_wait_for_animation_end({caller})")++ async def build_elements_and_draw_bounding_boxes(self, frame: str, frame_index: int) -> None:+ self.calls.append("build_elements_and_draw_bounding_boxes")++ async def remove_bounding_boxes(self) -> None:+ self.calls.append("remove_bounding_boxes")+++async def test_scrolling_helper_skips_overlay_when_draw_boxes_false() -> None:+ """With the deprecated overlay default (False), neither build nor remove fires."""++ stub = _StubSkyvernFrame(+ # scroll positions: top(0) → page1(700) → page2(1400) → terminal(1400)+ scroll_steps=[0.0, 700.0, 1400.0, 1400.0],+ # consistent scroll heights => no element-tree rebuild+ scroll_heights=[2000, 2000, 2000, 2000],+ )+ page = MagicMock(name="page")++ async def _fake_screenshot(page, mode): # noqa: D401, ARG001+ return b"snap"++ with (+ patch.object(page_module.SkyvernFrame, "create_instance", AsyncMock(return_value=stub)),+ patch.object(page_module, "_current_viewpoint_screenshot_helper", _fake_screenshot),+ ):+ screenshots, positions = await page_module._scrolling_screenshots_helper(+ page=page,+ url="https://example.com",+ draw_boxes=False,+ max_number=4,+ mode=ScreenshotMode.DETAILED,+ )++ # We still scrolled + captured screenshots normally.+ assert len(screenshots) >= 1+ assert positions == sorted(positions)+ # No overlay build or removal fired.+ assert "build_elements_and_draw_bounding_boxes" not in stub.calls+ assert "remove_bounding_boxes" not in stub.calls+ # Both scroll calls forwarded draw_boxes=False explicitly.+ assert any("scroll_to_top(draw_boxes=False)" in c for c in stub.calls)+ assert all("draw_boxes=True" not in c for c in stub.calls)+++async def test_scrolling_helper_non_scrollable_page_skips_overlay() -> None:+ """The non-scrollable branch must also avoid overlay build/remove by default."""++ stub = _StubSkyvernFrame(scroll_steps=[], scroll_heights=[])++ async def _is_window_scrollable() -> bool:+ return False++ stub.is_window_scrollable = _is_window_scrollable # type: ignore[method-assign]++ page = MagicMock(name="page")++ async def _fake_screenshot(page, mode): # noqa: D401, ARG001+ return b"snap"++ with (+ patch.object(page_module.SkyvernFrame, "create_instance", AsyncMock(return_value=stub)),+ patch.object(page_module, "_current_viewpoint_screenshot_helper", _fake_screenshot),+ ):+ screenshots, positions = await page_module._scrolling_screenshots_helper(+ page=page,+ url="https://example.com",+ draw_boxes=False,+ max_number=1,+ mode=ScreenshotMode.DETAILED,+ )++ assert screenshots == [b"snap"]+ assert positions == [0]+ assert "build_elements_and_draw_bounding_boxes" not in stub.calls+ assert "remove_bounding_boxes" not in stub.calls