Skip to content

Python

The vibium package on PyPI drives a real browser from Python. It bundles the vibium binary for your platform.

  • Python 3.11 or newer
  • Linux x64/arm64, macOS x64/arm64, or Windows x64
Terminal window
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install vibium

With uv, use uv add vibium. Chrome for Testing downloads the first time a browser starts. To fetch it ahead of time, run vibium install.

Save this as hello.py:

from vibium import browser
# Launch a browser. The window is visible by default.
bro = browser.start()
vibe = bro.page()
vibe.go("https://example.com")
with open("screenshot.png", "wb") as f:
f.write(vibe.screenshot())
link = vibe.find(role="link")
print("Found link:", link.text())
link.click()
bro.stop()

Run it:

Terminal window
python3 hello.py

A Chrome window opens, loads the page, clicks the link, and closes. The script prints Found link: Learn more and leaves screenshot.png in the folder.

CallWhat it does
browser.start()Launches Chrome and returns a Browser
bro.page()Returns the default page (tab)
vibe.go(url)Navigates to a URL
vibe.screenshot()Returns the page as PNG bytes
vibe.find(role="link")Finds an element by its accessible role
link.click()Clicks the element
bro.stop()Closes the browser

The default import is sync. vibium.async_api exposes the same API as coroutines:

import asyncio
from vibium.async_api import browser
async def main():
bro = await browser.start()
vibe = await bro.page()
await vibe.go("https://example.com")
link = await vibe.find(role="link")
print(await link.text())
await bro.stop()
asyncio.run(main())

Hide the browser window:

bro = browser.start(headless=True)

Launch Firefox instead of Chrome:

from vibium import firefox
bro = firefox.start()
# same as: browser.start(engine="firefox")

See Using Firefox for engine details.

find takes semantic locators as keyword arguments. They survive markup changes better than CSS:

vibe.find(role="button", text="Sign in")
vibe.find(label="Email")
vibe.find(placeholder="Search...")
vibe.find(testid="checkout")

A bare string is a plain-language description (vibe.find("the Add to Cart button")), and css="..." takes an exact CSS selector. Before 26.11.16 a bare string was a CSS selector.

result = vibe.run("open the contact page")
verdict = vibe.check("the page lists an email address")

Set VIBIUM_BIN_PATH to use your own build of the binary:

Terminal window
export VIBIUM_BIN_PATH=/path/to/your/vibium