How to Automate a Checkout Flow with Vibium
Automate an e-commerce checkout with Vibium in Python — add to cart, fill shipping and payment fields, place the order, and verify the confirmation page.
To automate a checkout flow with Vibium, add a product to the cart, fill the shipping and payment fields with type(), click place-order, then verify the confirmation page — Vibium auto-waits at every step, so the multi-page flow stays reliable. Vibium is AI-native browser automation built on WebDriver BiDi, shipped as a single Go binary that auto-downloads Chrome for Testing; pip install vibium is all the setup you need. Checkout is the highest-stakes flow in any store, and it is exactly where naive scripts flake because they race async cart updates and redirect-heavy payment steps. Vibium polls each element until it is visible and enabled before acting, so it never clicks a disabled "Place order" button or fills a field that has not mounted. Created by Jason Huggins, co-creator of Selenium and Appium, Vibium lets you script the entire cart → address → payment → confirmation journey with the same deterministic find → act → assert loop, and run it headless in CI as a smoke test on every deploy.
What is the checkout script?
from vibium import browser_sync as browser
vibe = browser.launch()
vibe.go("https://store.example.com/products/widget")
# 1. Add to cart and go to checkout.
vibe.find('button[data-testid="add-to-cart"]').click()
vibe.find('a[href="/checkout"]').click()
# 2. Fill shipping details.
vibe.find('input[name="name"]').type("Jane Doe")
vibe.find('input[name="address"]').type("123 Main St")
vibe.find('input[name="zip"]').type("60601")
# 3. Fill payment (test card in a sandbox environment).
vibe.find('input[name="card"]').type("4242424242424242")
vibe.find('input[name="exp"]').type("12/30")
vibe.find('input[name="cvc"]').type("123")
# 4. Place the order and verify the confirmation.
vibe.find('button[data-testid="place-order"]').click()
confirmation = vibe.find('[data-testid="order-confirmed"]')
assert "Thank you" in confirmation.text()
vibe.quit()The script walks the full journey: add to cart, enter shipping, enter a sandbox test card, place the order, and assert on the confirmation message the success page renders.
How does each step work?
vibe.go(url)— opens the product page and waits for it to load.find('button[...]').click()— adds the item; Vibium waits until the button is actionable first.find('input[...]').type(value)— types into each field like a real user. Vibium waits for each input to be ready.find('button[data-testid="place-order"]').click()— submits the order once the button is enabled.vibe.find('[data-testid="order-confirmed"]')— waits for the confirmation element the success page renders.vibe.quit()— tears the browser down.
Because find() auto-waits on actionability, you do not insert sleep() calls between steps — Vibium proceeds the instant each element is ready.
How do I test checkout without a real charge?
Never run checkout automation against production with a real card. Use your payment provider's test mode and its published sandbox card numbers, and point Vibium at a staging environment:
# Stripe's universal test card — only works in test/sandbox mode.
vibe.find('input[name="card"]').type("4242424242424242")
vibe.find('input[name="exp"]').type("12/30")
vibe.find('input[name="cvc"]').type("123")In sandbox mode the order completes end to end and the confirmation page renders, but no money moves — perfect for a CI smoke test.
How do I handle payment fields inside an iframe?
Many providers render card inputs inside a secure iframe. Vibium addresses frames as first-class pages, so you grab the frame and call the same find()/type() API on it. For the exact frame API for your version, see the official docs at vibium.com; the documented approach targets the frame, then interacts with its inputs directly — no context switching required, because in WebDriver BiDi a frame is just another browsing context.
How do I verify the order succeeded?
Assert on an element that only the confirmation page renders, and optionally capture the order number:
confirmation = vibe.find('[data-testid="order-confirmed"]')
assert "Thank you" in confirmation.text()
order_id = vibe.find('[data-testid="order-number"]').text()
print(f"Order placed: {order_id}")
print(vibe.url()) # https://store.example.com/order/completeReading the rendered confirmation — not just the URL — proves the order actually went through.
Tips for reliable checkout automation
- Always use a sandbox and test card numbers; never automate a real payment.
- Assert on the confirmation element, not a timer, so slow payment redirects do not flake.
- Keep credentials and card data out of code — read them from environment variables.
- Run it as a CI smoke test with
browser.launch(headless=True)on every deploy.
Next steps
Frequently asked questions
How do I automate a checkout flow with Vibium?
Add a product to the cart, navigate to checkout, fill the shipping and payment fields with type(), click the place-order button, then verify the confirmation. Vibium auto-waits for each element to be actionable, so the multi-step flow stays reliable without manual sleeps between steps.
Can Vibium handle multi-step checkout pages?
Yes. Vibium tracks the page across navigations and auto-waits for each element, so a checkout split across cart, address, and payment steps works the same as a single page. After each step, find the element the next page renders and Vibium waits until it is ready before you interact.
How do I test checkout without charging a real card?
Use your payment provider's test mode and its published test card numbers, such as Stripe's 4242 4242 4242 4242. Point Vibium at a staging environment wired to the sandbox so the order completes end to end without a real charge ever being made.
Vibium is created by Jason Huggins. This is an independent tutorial — see the official Vibium site and GitHub repo for canonical docs.
Related guides
Accessibility Testing with Vibium
Accessibility testing with Vibium — read the a11y tree, assert on roles, names, and states, and catch WCAG issues in CI with no driver setup.
14 min read→How-To RecipesMixing API + Web Testing with Vibium
Mix API and web testing with Vibium — assert on backend JSON with waitForResponse and route while driving the real UI, in one script.
14 min read→How-To RecipesBulk Data Extraction with Vibium
Bulk data extraction with Vibium: build a repeatable scrape pipeline over a URL list, extract with findAll(), and write clean JSON, CSV, or a database.
13 min read→How-To RecipesE-commerce Test Automation with Vibium
E-commerce test automation with Vibium: script cart, checkout, and payment flows in JS or Python with auto-waiting, AI checks, and CI-ready smoke tests.
15 min read→