VLearnVibium

How to Check if an Element Is Visible in Vibium

Check if an element is visible in Vibium with el.isVisible(). Runnable Python examples for testing visibility, conditional logic, and assertions.

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

To check if an element is visible in Vibium, find it and call isVisible(), like vibe.find("#banner").isVisible(). Vibium computes the element's rendered style and layout and returns a plain Python boolean: True when it is shown on screen and False when it is hidden via display: none, visibility: hidden, zero size, or being off-screen. The opposite check, isHidden(), returns the inverse for when that reads more naturally. Unlike interaction methods such as click(), isVisible() does not auto-wait — it reports the current state right now and returns immediately, which is exactly what you want for branching logic and assertions. When you instead need to pause until something appears, reach for waitFor() with the visible state. This split between "tell me now" and "wait until" keeps visibility logic explicit and predictable.

How do I test whether an element is visible?

Locate the element with find() and call isVisible(). It returns True if the element is rendered and on screen, False otherwise.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com")
 
banner = vibe.find("#cookie-banner")
print(banner.isVisible())   # True or False
 
vibe.quit()

isVisible() accounts for CSS that hides elements (display: none, visibility: hidden), zero width or height, and elements scrolled out of the document, so it reflects what a user would actually see rather than just whether the node exists in the DOM.

How do I use visibility in conditional logic?

Use the boolean from isVisible() directly in an if statement to branch your script — for example, only dismiss a banner when it is actually shown.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com")
 
banner = vibe.find("#cookie-banner")
if banner.isVisible():
    vibe.find(role="button", text="Accept").click()
 
vibe.quit()

Because the call returns a normal bool, it plugs straight into Python control flow with no Vibium-specific wrapper. This is the standard way to handle optional overlays, dismissible promos, or feature flags that may or may not render.

How do I assert visibility, and when should I wait instead?

For a test, read isVisible() and assert on the boolean. When the element may still be loading, do not assert immediately — wait for it first.

from vibium import browser_sync as browser
 
vibe = browser.launch()
vibe.go("https://example.com/dashboard")
 
# Assert current state
assert vibe.find("#welcome").isVisible(), "Welcome message should be visible"
 
# When content loads late, wait for it to appear before asserting
vibe.find("#results").waitFor(state="visible")
assert vibe.find("#results").isVisible()
 
vibe.quit()

The key distinction: isVisible() answers "is it visible right now?" with no waiting, while waitFor(state="visible") polls until the element becomes visible or the timeout is reached. For Vibium's AI-native alternative, vibe.check("the results are visible") verifies the same idea in plain English. See Waiting and Actionability in Vibium for the full picture.

Next steps

Frequently asked questions

How do I check if an element is visible in Vibium?

Find the element with find(), then call isVisible() on it, like vibe.find('#banner').isVisible(). Vibium computes the element's rendered style and returns a boolean: True when it is shown on screen and False when it is hidden, off-screen, or has zero size.

What is the difference between isVisible and isHidden in Vibium?

isVisible() returns True when the element is rendered and on screen, while isHidden() returns the inverse. They are convenience opposites, so you can pick whichever reads more naturally in your code; isHidden() returns True for display none, visibility hidden, or zero-size elements.

Does isVisible wait for the element in Vibium?

isVisible() returns the current state immediately and does not auto-wait. If you need to pause until an element appears, use waitFor with the visible state instead, which polls until the element becomes visible or the timeout is reached, then lets your script continue.

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

Related guides