VLearnVibium

How to Scroll to an Element in Vibium

Scroll to an element in Vibium with scrollIntoView(), or rely on auto-scroll before clicks. Runnable Python examples and mouse-wheel scrolling.

By Pramod Dutta··3 min read·Verified with Vibium 26.2
▶ Animated overview · made with Remotion

To scroll to an element in Vibium, find it and call scrollIntoView(), for example vibe.find("#footer").scrollIntoView(). Vibium scrolls the element into the viewport so it is visible on screen. In practice you rarely need this, because Vibium auto-scrolls before every interaction: when you call click(), fill(), hover(), or any other action, the engine first runs actionability checks (visible, stable, enabled) and scrolls the element into view as part of that process. So a plain vibe.find("#submit").click() already handles scrolling for you. You reach for the explicit scrollIntoView() only when you want an element on screen without interacting with it — for example before taking a screenshot of a section far down the page. For distance-based scrolling, such as triggering lazy-loaded content, use the mouse wheel with vibe.mouse.wheel(dx, dy). The runnable patterns for all three cases are below.

How do I scroll to a specific element?

Find the element, then call scrollIntoView() on it. Vibium brings the element into the visible viewport.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com")
 
footer = vibe.find("footer")
footer.scrollIntoView()
 
# now capture the section that is on screen
png = footer.screenshot()
with open("footer.png", "wb") as f:
    f.write(png)
 
vibe.quit()

scrollIntoView() only scrolls if the element is not already fully visible, so calling it on an element already in view is a no-op. Because finding and scrolling both happen inside Vibium's Go engine, the timing behavior is consistent regardless of selector strategy.

Do I need to scroll before clicking?

No — Vibium auto-scrolls before interacting, so you do not have to. Before click(), fill(), hover(), and similar actions, Vibium scrolls the target into view as part of its actionability checks.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com")
 
# this button could be far down the page —
# Vibium scrolls it into view automatically before clicking
vibe.find(role="button", text="Sign Up").click()
 
vibe.quit()

This is one of the biggest differences from classic WebDriver, where a click on an off-screen element can silently fail or throw. In Vibium the auto-scroll is built in, which removes a whole class of flaky-test failures. See Waiting and Actionability in Vibium for the full set of checks.

How do I scroll the page by a fixed amount?

Use the mouse wheel API when you want to scroll by distance rather than to a known element — for example to trigger infinite-scroll or lazy-loaded images.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com")
 
# scroll down 600px at a time to load more content
for _ in range(5):
    vibe.mouse.wheel(0, 600)
 
vibe.quit()

vibe.mouse.wheel(dx, dy) dispatches a real wheel event through WebDriver BiDi, so pages that listen for scroll events (lazy loaders, sticky headers, infinite feeds) react exactly as they would for a human. Combine it with findAll() to count newly loaded items after each scroll.

scrollIntoView() vs auto-scroll vs mouse wheel

  • el.scrollIntoView() — scroll a known element into view without clicking it (e.g. before a screenshot).
  • Auto-scroll — happens for free before click(), fill(), hover(), and other actions. No code needed.
  • mouse.wheel(dx, dy) — scroll by a pixel distance to trigger lazy-loaded or infinite content.

Reach for auto-scroll first (do nothing), scrollIntoView() when you need visibility without interaction, and the wheel when you need distance-based scrolling.

Next steps

Frequently asked questions

How do I scroll to an element in Vibium?

Find the element and call scrollIntoView() on it, for example vibe.find('#footer').scrollIntoView(). Vibium scrolls the element into the viewport. In most cases you do not even need this, because actions like click() and fill() auto-scroll the element into view first.

Does Vibium auto-scroll before clicking?

Yes. Before any interaction such as click(), fill(), or hover(), Vibium runs actionability checks and scrolls the element into view automatically. You only call scrollIntoView() explicitly when you need the element visible without interacting with it, such as before a screenshot.

How do I scroll the page by a fixed amount in Vibium?

Use the mouse wheel API: vibe.mouse.wheel(0, 600) scrolls down 600 pixels. This is useful for triggering lazy-loaded content or infinite-scroll lists where you want to scroll by distance rather than to a specific element.

Vibium is created by Jason Huggins. This is an independent tutorial — see the official Vibium site and GitHub repo for canonical docs.

Related guides