Tutorial

Build a Self-Running QA Testing Bot with the Computer Use API

Priya Patel||8 min
+Tab

Traditional QA tools rely on brittle selectors like CSS IDs or XPath. When UI changes even slightly, your tests break. You need a bot that can see the screen and act like a human. The computer use API lets you drive a real browser, click buttons, fill forms, and validate results using actual screenshots. It works with browsers, desktop apps, and terminals. You pay only for the agent steps you use. Let’s build a QA bot that opens a web app, performs a user flow, and reports success or failure.

How the QA bot works

The bot runs as a task run on the Coasty platform. You POST to /v1/runs with a machine_id, a task describing the test, and options like cua_version, max_steps, and deadline_seconds. The agent opens a browser (or desktop app) on the cloud VM, sees the screen, and follows your instructions. It interacts with the UI and reports status through webhooks. You get events for queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out. The agent is billed at $0.05 per step.

bash
curl -X POST https://coasty.ai/v1/runs \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "vm-abc123",
    "task": "Open https://example.com, click the login button, enter [email protected] and pass1234, then verify you are on the dashboard page.",
    "cua_version": "v4",
    "max_steps": 20,
    "deadline_seconds": 120,
    "on_awaiting_human": "pause",
    "webhook_url": "https://your-server.com/coasty-hook"
  }'

Track results with a webhook

  • Send a POST to /v1/runs with webhook_url to receive status updates.
  • On each event, decode the Server-Sent Events stream using the Last-Event-ID header for resumption.
  • Webhooks are HMAC signed with header Coasty-Signature: t=unix,v1=hex.
  • You can POST /v1/runs/{id}/cancel to stop a run early or POST /v1/runs/{id}/resume to restart.

1 run per test scenario, 1 webhook per status update. The agent steps cost $0.05 each.

Why this beats brittle automation

Selectors need to match every version of your UI. If you change a button class or move it to another column, your automation fails. The computer use agent sees the actual screen pixels, understands captions, and follows logical instructions like "click the button that says Submit". It works even when layout changes or accessibility labels shift. You can reuse the same task description for weeks while the UI evolves without updating your test code.

Next steps

  • Create a /v1/workflow DSL with task, assert, if, loop, and parallel steps for multi-step test suites.
  • Use /v1/ground to map a screenshot plus element description to exact x,y coordinates.
  • Use /v1/parse to turn pyautogui code into structured actions for reuse.
  • Prepay in USD to get credits: 1 credit equals $0.01.
  • Explore the MCP server to drive Coasty from Cursor, Claude Desktop, or other MCP clients.

You now have a blueprint for a self-running QA bot that sees and interacts with your application like a human. The computer use API eliminates brittle selectors and lets you focus on test logic, not element IDs. Get your API key at https://coasty.ai/developers and start automating with real screen interaction.

Want to see this in action?

View Case Studies
Try Coasty Free