How to Take a Screenshot in Vibium
Capture a full-page or element screenshot in Vibium and save it to disk. Complete, runnable Python examples for the screenshot() command.
To take a screenshot in Vibium, call screenshot() to get PNG bytes and write them to a file — for example png = vibe.screenshot() then open("out.png", "wb").write(png). It works on the whole page or on a single element: call screenshot() on the browser/page object for a full-page capture, or on an element returned by find() to capture just that region. Vibium returns the image as raw PNG bytes rather than writing a file for you, which makes it easy to stream the screenshot elsewhere — into a visual-diff tool, an S3 upload, or a vision model that an AI agent uses to verify the page. Because Vibium auto-waits for actionability, the element is ready before you capture it, so screenshots don't come out half-rendered or flaky. The complete, runnable patterns for both the full-page and single-element cases are below.
Take a full-page screenshot
from vibium import browser_sync as browser
vibe = browser.launch()
vibe.go("https://example.com")
png = vibe.screenshot()
with open("screenshot.png", "wb") as f:
f.write(png)
vibe.quit()screenshot() returns the image as PNG bytes. You write those bytes to a .png file yourself — Vibium doesn't hide the data behind a path, which makes it easy to stream the image somewhere else (an AI agent, an S3 upload, a visual-diff tool).
Screenshot a single element
Find the element first, then call screenshot() on it to capture only that region:
from vibium import browser_sync as browser
vibe = browser.launch()
vibe.go("https://example.com")
header = vibe.find("h1")
png = header.screenshot()
with open("header.png", "wb") as f:
f.write(png)
vibe.quit()Common uses
- Visual regression — capture a baseline image and diff it on every run.
- Debugging failures — screenshot the page when an assertion fails.
- Feeding AI agents — hand the PNG bytes to a vision model for verification.
Next steps
Frequently asked questions
How do I take a screenshot in Vibium?
Call screenshot() on the browser object to get PNG bytes, then write them to a file: png = vibe.screenshot(); open('out.png','wb').write(png).
Can Vibium screenshot a single element?
Yes. Find the element first, then call screenshot() on it to capture just that element instead of the whole page.
What format are Vibium screenshots?
Vibium returns screenshots as PNG image bytes, which you can write directly to a .png file.
Vibium is created by Jason Huggins. This is an independent tutorial — see the official Vibium site and GitHub repo for canonical docs.
Related guides
How to Click Elements in Vibium
Click buttons and links in Vibium with el.click(). Runnable Python examples plus how auto-waiting and actionability make clicks reliable.
2 min read→Commands & APIHow to Find Elements in Vibium
Find elements in Vibium with find() using CSS or semantic selectors. Runnable Python examples, findAll, and how auto-waiting works.
3 min read→Commands & APIHow to Get Element Text in Vibium
Read an element's text in Vibium with el.text(). Runnable Python examples for reading headings, asserting content, and looping over results.
2 min read→Commands & APIHow to Navigate to a URL in Vibium (go)
Navigate to any URL in Vibium with vibe.go(url). Runnable Python examples for opening pages, chaining navigations, and what go() waits for.
2 min read→