← All tutorialsScraping

Browser automation: flight prices

Spin up a headless browser, hit Google Flights, extract structured pricing. Screenshot for the audit trail.

Cost~$0.05 per session
Operations
browser.runbrowser.extractbrowser.screenshot

Prerequisites

  • browser.* enabled (Browserbase-backed sessions).

Walkthrough

1. Drive the browser

`actions` is a list of {goto, click, type, wait_for}. The session reuses cookies across actions.

bash# Drive the page with a tiny action DSL. No Playwright install needed.
curl -X POST https://www.upivia.com/v1/service-requests \
  -H "Authorization: Bearer $AGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service":"browser",
    "operation":"run",
    "payload":{
      "actions":[
        {"type":"goto","url":"https://www.google.com/flights"},
        {"type":"type","selector":"input[aria-label=Where from]","text":"SFO"},
        {"type":"type","selector":"input[aria-label=Where to]","text":"JFK"},
        {"type":"click","selector":"button[aria-label=Search]"}
      ]
    }
  }'

2. Extract structured data

browser.extract takes a CSS selector + a schema, returns typed records.

3. Screenshot for evidence

browser.screenshot returns a base64 PNG. Stash it next to the price snapshot in your DB.

Next steps

Audit every call at /audit-logs, watch spend at /usage, and tune budgets per service on the agent's page.

Create an account →