Multi-step web workflows: forms, clicks, and structured extraction
Chain navigation, interaction, and console checks
Real browser workflows combine multiple steps: navigate to a local dev server, fill a search form, click submit, check for JavaScript console errors, and extract structured results.
Example
# Run a multi-step QA check against a local app
praisonai browser nav http://127.0.0.1:3000
praisonai browser run "Fill the search input with 'agents', click Search, and verify at least 1 result card renders"
praisonai browser get-console-logsExample explained
- http://127.0.0.1:3000 — Targets your local dev build before shipping to production.
- praisonai browser get-console-logs — Catches silent JavaScript runtime errors even when the page visually loads.
Parse extracted page text into a strict Pydantic schema
Pair browser extraction with a typed Pydantic model so downstream scripts receive clean, validated JSON instead of messy prose.
Example
from pydantic import BaseModel
from praisonai import Agent
class PageCheck(BaseModel):
title: str
console_errors: int
passed: bool
raw_snapshot = 'Title: Pricing | Console errors: 0 | CTA button visible'
extractor = Agent(instructions='Extract PageCheck fields from the browser snapshot.')
report = extractor.chat(raw_snapshot, output_pydantic=PageCheck)
print(report.model_dump())Example explained
- class PageCheck(BaseModel) — Defines the exact contract your QA pipeline expects from the browser run.
- PageCheck.model_validate_json(…) — Validates types strictly so malformed extractions fail loudly.
Common pitfall: flaky waits on async UIs
Single-page apps update asynchronously after clicks. Instruct your browser agent to wait for a specific visible element or status text rather than scraping the DOM immediately after clicking.
Reference: documentation